Published using Google Docs
ReteleManual
Updated automatically every 5 minutes

Computer Networks Manual

Introduction

Socket Programming

General concepts

UDP sockets

TCP sockets

TCP/IP Stack

Link Layer

Ethernet Cables

Topologies

Network Interfaces

MAC address (physical address)

Link layer (only) networking equipments

Internet Layer

IPv4 Address

Netmask

LAN

Internet layer networking equipment

Gateway

Routing

Transport Layer

TCP

UDP

Application Layer

HTTP (Hypertext Transfer Protocol)

DNS (Domain Name System)

  1. Introduction

The Internet is a network of networks.

Communication in Internet is performed using network sockets.

  1. Socket Programming

Communication in Internet is performed using network sockets.

The socket API allows 2 or more processes (on the same machine or on different machines)  to communicate with each other using Unix file descriptors. The two most common sockets are UDP and TCP.

  1. General concepts

UDP

TCP

socket()

socket()

bind()

bind()

sendto()/recvfrom()

listen()

accept()/connect()

send()/recv()

  1. UDP sockets

  1. TCP sockets

Socket programming examples

  1. TCP/IP Stack

Application

DHCP, HTTP, DNS, SSH

Transport

UDP, TCP

Internet

ICMP, IPv4, IPv6

Link

ARP

  1. Encapsulation

  2. Link Layer

  1. Ethernet Cables

  1. Topologies

  1. Network Interfaces

  1. MAC address (physical address)

The physical (MAC - media access control) address of a network interface is a 48 bits unique identifier usually represented by 6 groups of 2 hexadecimal numbers. MAC address can be changed by software, in most network interfaces.

The broadcast MAC address is FF:FF:FF:FF:FF:FF.

ARP (Address Resolution Protocol) maps IP addresses to MAC addresses sending a query to the MAC broadcast address.

  1. Link layer (only) networking equipments

Link layer devices can transport any type of IP packets.

  1. Internet Layer

  1. IPv4 Address

An IPv4 addres is 32 bits long, represented in as 4 bytes in decimal separated by “.”(dot).

A network interface can have one or more IP addresses.

Special IP addreses:

localhost

127.0.0.1

private ip classes

10.0.0.0/8 from 10.0.0.0 to 10.255.255.255

172.16.0.0/12 from 172.16.0.0 to 172.31.255.255

192.168.0.0/16 from 192.168.0.0 to 192.168.255.255

Localhost address cannot be used as network address or broadcast address.

                

  1. Netmask

A netmask is 32 bits long and it is formed by zero or more  binary 1  followed by zero or more bynary 0.

11.........100.........0

         32 bits; x 1s; 32-x 0s; 0<=x<=32.

A netmask is represented either as an IP address (4 bytes in decimal separated by “.”) or in short /x where x is the number of 1s in the netmask.

Example: 11111111000000000000000000000000=255.0.0.0=/8

The netmask associated to an IP specifies the boundaries of the network that IP belongs to.

In a network with a netmask /x there are 2^(32-x) IP addresses. The first IP address is the address of that network, and the last one is the broadcast address. These to IPs can not be configured for network interfaces.

 

Adresa de retea.

Adresa de broadcast.

  1. LAN

  2. Internet layer networking equipment

  1. Gateway

  2. Routing

  1. Transport Layer

  1. TCP

  2. UDP

  1. Application Layer

  1. HTTP (Hypertext Transfer Protocol)

HTTP is the most popular Internet protocol. It is used for distributing web pages. The HTTP server runs (usually) on port 80, and the secure version HTTPS runs (usually) on port 443.

  1. DNS (Domain Name System)