Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Jörg Liebeherr (modified by M. Veeraraghavan) 1 IP Service IP Addressing Datagram Format Routing (Forwarding) Subnetting Fragmentation.

Similar presentations


Presentation on theme: "© Jörg Liebeherr (modified by M. Veeraraghavan) 1 IP Service IP Addressing Datagram Format Routing (Forwarding) Subnetting Fragmentation."— Presentation transcript:

1 © Jörg Liebeherr (modified by M. Veeraraghavan) 1 IP Service IP Addressing Datagram Format Routing (Forwarding) Subnetting Fragmentation

2 © Jörg Liebeherr (modified by M. Veeraraghavan) 2 IP (Internet Protocol) is a Network Layer Protocol. IP’s current version is Version 4 (IPv4). It is specified in RFC 891. Orientation

3 © Jörg Liebeherr (modified by M. Veeraraghavan) 3 Orientation IP layer processing occurs at both routers and hosts:

4 © Jörg Liebeherr (modified by M. Veeraraghavan) 4 IP Service IP provides an unreliable and connectionless service (“datagram service”). Unreliable: IP does not guarantee that a transmitted packet will be delivered. Connectionless: Each packet (“datagram”) is handled independently. IP is not aware that packets between hosts may be sent in a logical sequence. Consequences of an unreliable, connectionless service –Lost packets –Packets delivered out-of-sequence –Can have duplicate packets because of TCP layer resends* e.g. if packet is delivered but ACK is lost, TCP sender will resend packet buffered at the end host. *: The audio file says duplicate packets could occur because of router-buffered packets; this is not commonplace in today’s networks because common link-layer protocols do not have retransmissions, but if they did, this could be another cause of duplicate packets; for example, 802.11 wireless link layer has retransmissions.

5 © Jörg Liebeherr (modified by M. Veeraraghavan) 5 IP Service IP offers a best effort * service; i.e., IP does not make performance guarantees on: the time until a packet is delivered the packet loss rate the throughput of traffic between two hosts etc. Performance guarantees are also called Quality-of-Service or QoS guarantees. IP provides limited QoS support. This is done via the Type-of- Service (TOS) field. * “Best effort” may mean different things to different people.

6 © Jörg Liebeherr (modified by M. Veeraraghavan) 6 IP supports the following services: one-to-one (unicast) one-to-many (multicast) one-to-all (broadcast) IP multicast actually supports a many-to-many service. IP multicast requires support of other protocols (IGMP, multicast routing). IP Service UnicastBroadcast Multicast

7 © Jörg Liebeherr (modified by M. Veeraraghavan) 7 Internet Addresses Each network interface on the Internet as a unique global address, called the IP address. An IP address: - is 32 bits long. - encodes a network number and a host number IP addresses are written in a dotted decimal notation : - 128.238.42.112 means 10000000 in 1 st Byte 11101110 in 2 nd Byte 00101010 in 3 rd Byte 01110000 in 4 th Byte

8 © Jörg Liebeherr (modified by M. Veeraraghavan) 8 Internet Address Classes IP distinguishes 5 classes of addresses.

9 © Jörg Liebeherr (modified by M. Veeraraghavan) 9 IP Addresses The end points of each range are not allowed because all zeros and all ones are disallowed for netid, subnetid and hostid (see pg. 42 of text and RFC791).

10 © Jörg Liebeherr (modified by M. Veeraraghavan) 10 Trade-off of Address Classes There are a total of 2 32 = 4,294,967,296 IP addresses Class A: 7 bits for netid  only 128 Class A networks each net can have about 16 million (2 24 -2) hosts. Class B: 14 bits for netid  about 16,000 networks About 65,000 (2 16 -2) hosts per network Class C: 21 bits for netid  about 2 million networks Only 254 hosts per network

11 © Jörg Liebeherr (modified by M. Veeraraghavan) 11 Special case IP addresses (not complete) 0: all zeros (means “this host” or “this net”); -1: all ones (this is reserved for broadcasts); netid, subnetid, hostid: anything else

12 © Jörg Liebeherr (modified by M. Veeraraghavan) 12 20 bytes  Header Size  2 4 * 32 bit-words = 60 bytes 20 bytes  Total Length  2 16 bytes = 65536 bytes IP Datagram Format

13 © Jörg Liebeherr (modified by M. Veeraraghavan) 13 IP Datagram Transmission Question: If you measure an IP datagram on the network, in which order are the fields transmitted? Answer: Transmission is row by row For each row: 1. Transmit bits 0-7 2. Transmit bits 8-15 3. Transmit bits 16-23 4. Transmit bits 24-31 This is called network byte order or big endian byte ordering. Note: some computers store 32-bit words in little endian format. Which ones?

14 © Jörg Liebeherr (modified by M. Veeraraghavan) 14 Fields of the IP Header Version: current version is 4, next version will be 6. Header length (4 bits): Number of 32-bit words in the IP header Type of Service (TOS): contains 4 TOS bits, where each bit indicates a desired service. minimize delay maximize throughput maximize reliability minimize cost –Only one bit can be set! Not supported in all applications.

15 © Jörg Liebeherr (modified by M. Veeraraghavan) 15 IP Header Fields Contd. Total Length: Number of bytes in the IP datagram (header+payload) Identification: unique identification of a datagram from a host. Incremented whenever a datagram is transmitted. Flags and Fragment Offset: Associated with fragmentation Time To Live (TTL): specifies longest path before datagram is dropped. –Used to prevent infinite looping of packets –TTL field is set at sending host and is decremented by 1 at each router –If a router gets a datagram whose TTL is either 0 or 1, the router will drop the packet. –If a destination host gets a datagram whose TTL is 1, the host will deliver the datagram to the higher layer.

16 © Jörg Liebeherr (modified by M. Veeraraghavan) 16 Fields of the IP Header Protocol: Specifies the higher-layer protocol. Used for demultiplexing to higher layers. Header checksum: verifies correctness of header.

17 © Jörg Liebeherr (modified by M. Veeraraghavan) 17 Fields of the IP Header Source and Destination Addresses: identify the interfaces on the sending and receiving hosts Options: Security restrictions Record Route: each router that processes the packet adds its IP address to the header. Timestamp: each router that processes the packet adds its IP address and time to the header. (loose) Source Routing: specifies a list of routers that must be traversed. (strict) Source Routing: specifies a list of the only routers that can be traversed. Padding: ensures that header ends on a 4-byte boundary

18 © Jörg Liebeherr (modified by M. Veeraraghavan) 18 Routing The routing functions at the network layer must be able to deliver a packet from a source host to a destination host. There are two parts to the routing problem: 1. How to pass a packet from an input interface to the output interface of a router (“packet forwar- ding”) ? 2.How to create routing tables? In this lecture, we only discuss the packet forwarding part. The other function is discussed in Lecture 6.

19 © Jörg Liebeherr (modified by M. Veeraraghavan) 19 Major Tenets for Datagram Forwarding Every IP datagram contains the IP address of an interface of a destination host. The network id of an IP address uniquely identifies a single physical network that is part of the larger Internet. All hosts and routers that have the same network id are connected to the same physical network and can directly communicate by sending MAC layer frames. Every physical network of the Internet has at least one router, which is also connected to at least one other physical network.

20 © Jörg Liebeherr (modified by M. Veeraraghavan) 20 A packet is typically forwarded to a large number of routers before reaching the destination host. IP forwarding is done on a hop-by-hop basis, i.e., no one knows the complete route. The goal of forwarding is to bring the IP datagram closer to the destination. IP Forwarding

21 © Jörg Liebeherr (modified by M. Veeraraghavan) 21 IP Forwarding IP forwarding is performed by both hosts and routers. The difference between IP forwarding in a host and in a router is that a host’s IP module does not forward packets received on an interface to another interface (if it does then it is behaving as a router). In a host, IP forwarding is from the higher layers to an interface or vice versa Both routers and hosts have a routing table. Routing table entries look like this and is looked up for each datagram:

22 © Jörg Liebeherr (modified by M. Veeraraghavan) 22 Flags H: Whether the destination address is the network ID of an IP address (H=0) or the complete IP address of a host interface (H=1). G: Whether the next-hop router field is really a next-hop router (G=1) or a directly connected interface (G=0)

23 © Jörg Liebeherr (modified by M. Veeraraghavan) 23 Forwarding Functions at Host Forwarding an IP datagram at a host: DestNet = Network id in destination IP address If (DestNet == my Network id) Deliver datagram to destination directly; else Send datagram to default router; Reception of an IP datagram at a host: Datagram is received on an interface If (Destination IP address == (my IP address || broadcast address)) Deliver datagram to higher layer; else Discard the datagram;

24 © Jörg Liebeherr (modified by M. Veeraraghavan) 24 Forwarding Functions at Router Reception of an IP datagram at a router: Packet is received on an interface If (Destination IP address != my IP address) Perform datagram forwarding; Forwarding an IP datagram at a router: DestNet = Network id in destination IP address DestIP = destination IP address If (DestIP == Destination IP address in my routing table) Deliver datagram to the next-hop-router in the table; elseif (DestNet == Network id in my routing table) Deliver datagram to destination of the interface; else deliver packet to default router;

25 © Jörg Liebeherr (modified by M. Veeraraghavan) 25 Example (from Textbook) Scenario 1: bsdi sends a datagram to sun Scenario 2: bsdi sends a datagram to ftp.uu.net

26 © Jörg Liebeherr (modified by M. Veeraraghavan) 26 Scenario 1 Bsdi looks up its routing table and finds sun as being located on the same network. How ? The network address of sun and bsdi match. Bsdi issues an ARP request for 140.252.13.33 Sun replies with the MAC address for its interface Bsdi can then send the IP datagram encapsulated in an ethernet frame

27 © Jörg Liebeherr (modified by M. Veeraraghavan) 27 Scenario 2 bsdi sends a datagram to ftp.uu.net. 1. bsdi sees that its network ID differs from that of the destination address 2. So it sends the datagram to its default router (sun) (by using the MAC address of the 140.252.13.33 interface on sun - obtained by ARP)

28 © Jörg Liebeherr (modified by M. Veeraraghavan) 28 Scenario 2, Part II 3. sun (is configured as router) forwards the packet to its default router (which is set to netb). 4. netb forwards the datagram to its default next-hop-router, set to Gateway (140.252.1.4). 5. Gateway forwards the packet to somewhere else (not known).

29 © Jörg Liebeherr (modified by M. Veeraraghavan) 29 Subnetting The address classes makes Class A and B addresses very attractive and Class C addresses not attractive: - The number of network id’s relates to the size of the routing table in IP routers. - The number of hosts on a network is limited to 255. - Organization must contact IANA for each new LAN. -Management of a large number of Class C addresses is cumbersome. But: There are only few Class A and B addresses! Solution: Subnetting

30 © Jörg Liebeherr (modified by M. Veeraraghavan) 30 Subnetting Goal: Reduce the need for a large number of network ids. Basic Idea: - Split the host id portion of an IP address into a subnet id and a host id. - Assign one subnet id to each physical network. Then: Subnets can be freely assigned and be used for many physical networks. Distant routers need not be aware of subnet id’ s.

31 © Jörg Liebeherr (modified by M. Veeraraghavan) 31 Routers and hosts use a subnet mask to separate the subnetwork id from the host id. Subnet Masks Question: In the IP address 152.164.9.10 with subnet mask 255.255.255.128, what class does this IP address belong to and what are the 14 bits netid, subnet id and hostid? How many bits are in the subnet id and in the hostid? Answer: Class B; 14 bits netid = 24.164, subnet id (9 bits) = 9.0 hostid (7 bits) = 10

32 © Jörg Liebeherr (modified by M. Veeraraghavan) 32 Subnetting: Host Processing Each host has to know the IP address and the subnet mask of its interface For each IP datagram received from the application, the IP layer at the host peforms: if ((Destination IP address & Subnet Mask) == (My IP address & Subnet Mask)) Deliver datagram directly (perform ARP if shared medium LAN); else Forward datagram to default router;

33 © Jörg Liebeherr (modified by M. Veeraraghavan) 33 Subnetting: Router Processing A router has a table: »SubnetNumber is the »SubnetMask is the subnet mask »NextHop is the IP address of a router. The router perfoms the following algorithm: –Reception of an IP datagram at a router: Packet is received on an interface whose IP address is IP1. dest = destination IP address; If (dest == IP1) Deliver datagram to TL/application in router ;

34 © Jörg Liebeherr (modified by M. Veeraraghavan) 34 Subnetting: Router processing Contd. Else for each entry sub1 = dest & SubnetMask; if (sub1 == SubnetNumber) Forward datagram to NextHop; else Go to next entry in routing table;

35 © Jörg Liebeherr (modified by M. Veeraraghavan) 35 Advantages of Subnetting Improves efficiency of IP address usage by not consuming an entire Class B or Class C address for each physical network. Reduces routing table sizes. Since external routers do not know about subnetting, the size of routing tables is reduced. Networks become easier to manage. Note that there are three levels of aggregation: Network Subnet Host

36 © Jörg Liebeherr (modified by M. Veeraraghavan) 36 IP Fragmentation Host A sends a large IP datagram to Host B. Any Problem with that? MTUs: FDDI: 4352 Ethernet: 1500 IP router splits the datagram into several fragments Fragmentation requires that the data portion of every fragment except the last be a multiple of 8 bytes.

37 © Jörg Liebeherr (modified by M. Veeraraghavan) 37 Where is Fragmentation done? Fragmentation can be done at the sender or at intermediate routers. The same datagram can be fragmented several times. Reassembly of original datagram is only done at destination hosts.

38 © Jörg Liebeherr (modified by M. Veeraraghavan) 38 What’s involved in Fragmentation? The following fields in the IP header are involved: Identification is the same in all fragments. Flags contains a “more fragments” bit. (There is also a “don’t fragment bit” that can be set). Fragment offset contains the offset (in 8-byte units) of current fragment in the original datagram. Total length is changed to be the size of the fragment.

39 © Jörg Liebeherr (modified by M. Veeraraghavan) 39 Multiple links The ID field stays the same for all fragments of a datagram sent by a sender to allow for reassembly The fragment offset is relative to the datagram sent by the sender. Two fragments created on X.25 link (offsets 0, 69) –576 – 20 (IP header) = 556; 552 divides by 8 as 69. Each is fragmented further on the PPP link –ID stays the same on all fragments –Fragment offset on the second set of fragments is relative to the original (0, 34, 68, 69, 103) 296-20=276; 272/8 = 34

40 © Jörg Liebeherr (modified by M. Veeraraghavan) 40 Configuring a Network Interface The ifconfig command is used for setting and testing network interfaces (in Unix systems) that run TCP/IP Ifconfig must be run at boot time to initialize the network interfaces. Ifconfig -a plots a report on all interfaces. : aida:/ ; ifconfig -a ed1: flags=8863 mtu 1500 inet 128.238.42.114 netmask 0xffffff00 broadcast 128.238.42.255 lo0: flags=8049 mtu 16384 inet 127.0.0.1 netmask 0xff000000

41 © Jörg Liebeherr (modified by M. Veeraraghavan) 41 Configuring a Network Interface The netstat command plots (a lot of) network related data structures in the operating system. Netstat -i plots information on the network interfaces. : aida:/ ; netstat -i Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll ed1 1500 128.238.42.114 aida 2394482 35664 346880 223 119591 lo0 16384 your-net localhost 153 0 153 0 0


Download ppt "© Jörg Liebeherr (modified by M. Veeraraghavan) 1 IP Service IP Addressing Datagram Format Routing (Forwarding) Subnetting Fragmentation."

Similar presentations


Ads by Google