IP Routing, Datagram Routing, and Transport Layer

K- IP Routing & Transp:1-Datagram Routing:

Decision-making process on where to forward datag. Any device making such decision is called a router. Routing can be direct (host part of the LAN) or indirect (other cases). Routers form a cooperative interconnected structure. Datagrams pass from router to router until they reach a router capable of delivering directly (locally) to the destination.

Table Driven Routing:

Every router maintains a routing table with entries in the form of pairs-(N, G), where N is the netid of the dest net & G is the IP addr of the next router (it must be reachable) along the path to the dest net N.

Default Routes:

Address where all LAN hosts send datag with the dest outside the LAN.

Host-Specific Routes:

Special routing info for administrative, security, or technical reasons.

2-Routing Alg:

Extract the dest IP addr (DA) from the datag and using the netmask determine the netid of the dest network:

  1. If DA corresponds to a host-specific route, send the datag directly to the dest host.
  2. If netid is equal to the netid of a directly connected LAN, then deliver directly (locally).
  3. If netid can be found in the routing table, send the datag to the corresponding next router.
  4. If the default route is specified, send the datag to the default gateway.
  5. Otherwise, send an ICMP Dest unreachable message to the datag sender.

ICMP:

Internet Control Message Protocol, IP proto= 1. Simplest proto for net control and error messg passing, RFC 792. Its header does not have a fixed struct (except for the first 4B). Field TYPE shows ICMP message purpose and determines format (0 echo reply, 8 echo request, 3 dest unre, 11 TTL exceeded, 5 route change).

3-IPv6:

128b addrs (4 groups 16 bits, multicast FF), improvements- Larger address space – 3.4×10^38 addr. Multicasting, SLAAC-Stateless addr autoconfig-using Neighbor Discovery from router with ICMPv6 protocol (can be used DHCPv6 or static settings), mandatory network security, mobility, jumbogram…

Routing:

Simplified, less packet header, no checksum, TTL replaced by Hop limit, IPv6 Routers don’t do fragmentation, Minimal MTU is 1280, perform MTU discovery, routing prefix specify all routing information.

Change from v4 to v6:

Dualstack-router handle IPv4 & v6 together. Tunneling-encapsulation v6 in v4 proto. Proxying and translation for IPv6-only host. Backward compatibility- v6 host can communicate with v4 net.

4-Transp Layer:

Layer that enables connector-oriented data transfer, end-to-end comm, distinguishes different senders and receivers on one host, ensures reliability, QoS & control data transfer. It supposes 3 types of net layers: Cat A: no lost pack & no disconnect-local net. Cat B: no lost pack, some disconnec-private data net. Cat C: lost packs and disconn-internet. 5 classes Transp layer: TP0-simple layer for cat A, TP1- for B, solves disconn. TP2-for A,enables use one net layer for more transport connec – ports. TP3-for B, enables use one net layer for more transport connec and handle disconnec. TP4-for C, reliable data transfer. App can select TCP or UDP. Network layer uses host as a unit. Transp layer distinguishes users on host – different apps from different users, also does multiplex – gathers data from different users and makes demultiplex – received data are assigned to different users. To distinguish users transportation layer cannot use PID, because PIDs are dynamical, static gates (ports) are used. ISO/OSI defines SAP – Service Access Point. App connects to SAP and uses it as a distinguishing descriptor.

Socket vs Port:

Port is a number that defines SAP for connection from different apps. Socket, a pair of IP & port, was created as an abstract file for controlling data transfer through SAP. Sockets were used for networking as API for using ports SAPs. Sockets depend on specific implementation (WINSOCK for Windows, BSD Socket for Unix).

PORT Nº:

20- FTP data, 21 FTP control, 22 SSH, 23 Telnet, 25 SMTP, 80 HTTP, 100 POP3, 443 HTTPS.

5-UDP:

User Datagram Proto, IP proto = 17. Very simple transp proto, RFC 768. Provides connectionless and unreliable transport (reliability implemented in users app if needed) of user datagrams. Address target proc on dest host using port field (source port optional; 0 if unused). To ensure that different hosts on the Internet will understand each other, IANA made Well Known Port Numbers.

6-TCP:

Most important reliable transp service providing a virtual bidirectional comm channel between 2 hosts, uses data stream, ports and virtual connect (used to simulate that apps are connected through a dedicated line). Passive (server) and active (client) endpoint opening. Also provides: Buffered transp & full duplex connect (acknowledges data running in one dir in the packets, that are sent together with data in the opposite dir).

Reliability:

Ensured by positive acknowledging of received data together with repeated packet transfer, lost packet repeated based on timeouts. Datagrams may get duplicated data or ACK- solved by SEQ number datag. Also uses moving window to flow control.

TCP/IP Segment:

TCP data stream is split into segments that over the Internet as IP datag. Every byte in the data stream has its 32-bit sequential number within the connection. TCP header fields- SOURCE & DEST PORT: App ids on both connec endpoints. SEQUENCE NUMBER: nº first byte in the data stream transferred in the datag. ACK: nº first byte in the opposite stream, which sender expects from receiver as an answer. HLEN: in 32-bit words. CODE: Structured field containing 1-bit flags (URG, ACK, PSH: immediate delivery, RST: reset, SYN: Active request to establish a connection (sequence nº synch) FIN). WINDOW: Determines how much data the sender can accept in the opposite running data stream. URGENT POINTER: Pointer to an urgent data element in the segment data section (e.g., ctrlC in a Telnet session) – makes sense only if the URG flag is set. OPTIONS: Optional fields used during the connection negotiation (e.g., maximum segment size).

Establishing Connection:

Three-stage procedure to establish VC: 1. Client sends server a segment with SYN=1, random SEQ=x (enables detect failure or restart) & empty data. 2. The server responds with SYN and ACK bits set to 1, random SEQ=y & ACK= x+1. 3. Client acknowledges it sending ACK set to 1, SYN bit=0 and the ACK=y+1.

Connection Termination:

Normally terminated on request (FIN bit) of one of the connected applications (If server-passive close, If client-active close). Necessary also to close the opposite dir. The party that received the segment with FIN bit reacts by sending a segment with FIN bit too. The TCP connection can be terminated forcibly using the RST bit.

Flow Control:

Rcv sends to sender size of its free part of rcv buffer. Sender sends packet with data. Receiver accepts data and computes new size of free part of buffer and sends acknowledgment with this new size (If no space, sends 0 and blocks sender).

Retrans Timeouts:

Constant timeout value is inappropriate. TCP/IP adapts to timeouts of VC, using an alg based on round trip time (RTT). The real timeout is then computed as a weighted average of RTT. This strategy quickly accommodates to the speed and load changes on the intermediate networks and routers.

7-API for Net Services:

The basic system API for network communication is a socket, create socket- get a socket file descriptor- sock_descr = socket(af, type, protocol). Assign socket a local addr (passive sock open – server) bind(sock_descr, local_addr, addr_len). Listen for incoming connect (server) listen(sock_descr, backlog). An incoming connection arrived (server gets client id) new_sd = accept(sock_descr, *client_addr, *client_addr_len). Connect to a remote addr (active open – client) connect(sock_descr, remote_addr, addr_len). Data transfers using write, send, sendmsg, read, recv, recvmsg. Terminating the connection close(sock_descr). Server does– socket, bind, listen, accept, recv/send, or read/write, close(passive). Client does-socket, connect, send/recv or write/read, close (active).