Network/Internet Layer. (Chapter 5, Tanenbaum) Internet comprises different types of network supporting different types of protocols and services. ∎ ∎ ∎ ∎ ∎ All PCs support TCP/IP Internet Protocol Large mainframes run IBM’s SNA Telephone companies like to run ATM networks Wireless networks use variety of protocols Engineering units run UNIX workstations running TCP/IP Various networks differ in many ways. How networks could be connected? ∎ Connection-oriented: Concatenated Virtual Circuits. Packets may travel sequentially as a train over several different types of virtual circuits. ∎ Connectionless Internetworking Packets travel as datagrams from subnet to subnet via a set of gateway routers (not always the same) without any guarantee of correct order of delivery. ∎ Tunneling (source & destination host same type) Packets travel as payloads within a wrapper. Here frames are sent to a Multiprotocol Router which wraps each into a packet within a WAN wrapper and send them out via the Internet. Internet Routing. The network comprises independent AS (Autonomous Systems). Two protocols: • Interior Gateway protocol: Protocol to be used within each network, within a single AS. • Exterior Gateway protocol: Protocol to be used between two networks, between two ASs. Traffic types: In terms of spatial property Ingress: Traffic for and within an AS Egress: Traffic for a host outside AS Each network imposes some maximum size on packets. Therefore, packet fragmentation and reassembly. Problem: A larger sized packet cannot as is travel through subnets capable of handling smaller sized packets. Therefore, a gateway might fragment a packet into smaller sized packets and send them out as IP packets. Two approaches to fragmentations: MTU: Maximum Transmission Unit . IP header (as in IPv4) indicates if and how many fragments of a packet in terms of MTU follows next. IP header size = 20 bytes Suppose Packet size = 4350 bytes, MTU = 1404 bytes Max size of a fragment = 1404 – 20 = 1384 bytes Number of fragments = 4350/1384 < 4 (take the ceiling) For each packet, offset would be the starting point of the original packet (as an integer multiple of 8 bytes) Offset for 1st fragment: 0 Offset for 2nd fragment: 173 Offset for 3rd fragment: 346 Offset for 4th fragment: 519 A typical IP header for a fragment would appear as Version: 4 or 6 IHL: header length in a bunch of 4 bytes. Min: 5 DSCP: Differentiated service code points (Type of service) ECN: Notification of network congestion without dropping packets Total length: Total length of the packet Identification: Fragmentation ID Flags: 3 bit field Bit 0: reserved Bit 1: Don’t fragment (DF) Bit 2: More fragment (MF) (For the last fragment = 0) Fragment offset: As explained TTL: by hops (how long it should be kept alive) Protocol: The protocol number as listed in RFC 790 IP address For nodes to communicate, each must have an address. Every Address A has two parts: prefix, and suffix. 𝐴𝑖 = (𝑃𝑟𝑒𝑓𝑖𝑥𝑖 , 𝑆𝑢𝑓𝑓𝑖𝑥𝑖 ) 𝑃𝑟𝑒𝑓𝑖𝑥𝑖 = subnet address 𝑆𝑢𝑓𝑓𝑖𝑥𝑖 = host address A network component (host, router, GW) interface (NIC card) is referred by its (now) 32-bit address usually indicated in a dotted decimal format: ddd.ddd.ddd.ddd (4 octets) An interface: Connection between a router, host and physical link. Routers have typically multiple interfaces, hosts may have multiple interfaces, each interface would require an IP address. IP address: Network (prefix bits) + host (suffix bits) How to find network? Detach each interface from routers, hosts. What remains is a network. Classfull addressing: Class A: 0 * * * * * * *| host bits B: 0 1 * * * * * *| * * * * * * * *| host bits C: 0 1 1 * * * * *| * * * * * * * *| * * * * * * * *| host D: 0 1 1 1 Multicast address Class spans: A: From 1.0.0.0 to 127.255.255.255 B: From 128.0.0.0 to 191.255.255.255 C: From 192.0.0.0 to 223.255.255.255 D: From 224.0.0.0 to 239.255.255.255 Number of networks, number of hosts To discern suffix from its prefix, one employs an address mask. If A = Address and M = Mask, the network address N = A ^ M Suppose, A = 128.12.14.3 and M = 255.255.0.0 (given). Then this device is on the network N = (A&M) A = 10000000 00001100 00001110 00000011 M = &11111111 11111111 00000000 00000000 N = 10000000 00001100 00000000 00000000 = 128.12.0.0 Classless networks and CIDR convention. Boundary between a prefix and the following suffix need not be fixed. If actual number of hosts is lower than what a suffix would allow, classless network allows more networks. Consider a C-class address with a potential 256 hosts on it. This could be seen as 110……………..|……..| 24 31 Suppose we extend it to a 26 bit prefix and 6 bit suffix 110 ……………00|xxxxxx 110 ……………01|xxxxxx 110 ……………10|xxxxxx 110 ……………11|xxxxxx We get 4 new subnets with 32 potential hosts on each. From outside, it would appear as a single network, but from inside for internal management it would appear 4 distinct networks. This is the principal behind network subnets. A CIDR convention allows a network specification with its address and its prefix/suffix boundary as follows: ddd.ddd.ddd.ddd/m indicating m consecutive 1 in its mask bits. e.g. 193.15.48.69/27 implies a mask 11111111 11111111 11111111 11100000. The subnetwork address N, in this case, is A = 11000011 00001111 00110000 01000101 M = 11111111 11111111 11111111 11100000 N = 11000011 00001111 00110000 01000000 = 193.15.48.64 Local host address = 00101 Highest host address on this subnet = 11111 Some Special network addresses: a. 127.0.0.0 is used for loop-back address (typically in the form of 127.0.0.1) b. Prefix = all 0, suffix = all 0: This computer c. Prefix = network, suffix = all 0: This network d. Prefix = network, suffix = all 1: Broadcast on this network NAT (Network Address Translator) Too many hosts. Too few addresses. NAT offers a way out. For an organization with multiple hosts, this is the picture. • Public IP addresses map to private local addresses • NAT may use port number to distinguish local hosts. Not well known port numbers are used. Scheme in NAT Overloading. http://cisco-lessons.wikispaces.com/Network+Address+Translation Private addresses are addresses on LAN only, and cannot be used on Internet. Public addresses are routable, private are not. Here are the set of standard private addresses. Different types of NAT. • Static NAT: Single private IP address maps to a single IP address. • Dynamic NAT: Single IP address maps to an IP address from a pool of public IP addresses • NAT overloading (Port Address Translation): Multiple IP addresses are mapped to single public IP address separated by port numbers.