1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT
2 Linux Networking Lal Paul The Internet Protocol (IP) Provides delivery of packets from one host in the Internet to any other host in the Internet, even if the hosts are on different networks Internet packets are called “datagrams” and may be up to 64 kilobytes in length (although they are typically much smaller) Provides delivery of packets from one host in the Internet to any other host in the Internet, even if the hosts are on different networks Internet packets are called “datagrams” and may be up to 64 kilobytes in length (although they are typically much smaller)
3 Linux Networking Lal Paul 32 bits long Notation: Each byte is written in decimal in MSB order, separated by decimals ( – in decimal notation) 32 bits long Notation: Each byte is written in decimal in MSB order, separated by decimals ( – in decimal notation) IP Addresses
4 Linux Networking Lal Paul IP Address Classes Address Classes Class A, B, C, D, E Loopback Broadcast Address Classes Class A, B, C, D, E Loopback Broadcast
5 Linux Networking Lal Paul IP Address Classes 0Net 32 bits Type of Serv.Host 10NetHost 110Net Host 1110Multicast address 11110Reserved A B C D E Class
6 Linux Networking Lal Paul IP Address Classes Class A: For very large organizations 16 million hosts allowed : from 0xxx, or 1 to 126 decimal. Class B: For large organizations 65 thousand hosts allowed : from 10xx, or 128 to 191 decimal. Class C For small organizations 255 hosts allowed : from 110x, or 192 to 223 decimal Class A: For very large organizations 16 million hosts allowed : from 0xxx, or 1 to 126 decimal. Class B: For large organizations 65 thousand hosts allowed : from 10xx, or 128 to 191 decimal. Class C For small organizations 255 hosts allowed : from 110x, or 192 to 223 decimal
7 Linux Networking Lal Paul IP Address Classes (Cont’d) Class D Multicast addresses No network/host hierarchy : 1110, or 224 to 239 decimal. Class E Future Use begin with 1111, or 240 to 254 decimal.
8 Linux Networking Lal Paul Subnets Large Network Internet
9 Linux Networking Lal Paul Subnets Departments after subnetting A B C D
10 Linux Networking Lal Paul Subnet Masks A binary number used to compare the destination address to the local IP address and to determine whether those destinations are on the same subnet or not.
11 Linux Networking Lal Paul
12 Linux Networking Lal Paul
13 Linux Networking Lal Paul Subnet Masks Assume your machine is and has a subnet mask and a packet is send to How to find whether the destination host is on the same subnet or not Anding the IP Address with the subnet mask will give the Network Address.Hence the both Ips are Anded and the system will determine the network address Assume your machine is and has a subnet mask and a packet is send to How to find whether the destination host is on the same subnet or not Anding the IP Address with the subnet mask will give the Network Address.Hence the both Ips are Anded and the system will determine the network address
14 Linux Networking Lal Paul Ping Net id Net id Net id && = (Net id) Hence reject && = (Net id) Hence Accept
15 Linux Networking Lal Paul 2.3 IP Routing ABCDWXYZ ? How do you get a packet from one network to another?
16 Linux Networking Lal Paul IP Routing (cont’d) ABCDWXYZ R Answer: with a router (or a series of routers) ABCDWXYZ RR Network Cloud Case 1: Single hop Case 2: Multi-hop
17 Linux Networking Lal Paul Example N2N3N4 Actual routing table contains IP addresses, Flags indicating type of entries, net mask etc. (see Stevens pg. 113, sect 9.2) Routing R2 N1 R1R2R3 N1 N2 N3 N4 R1 Deliver directly R3 DestNext hop
18 Linux Networking Lal Paul How packet travels ping Gw: Gw: Gw: Gw: && = Packet sent to Gateway No route Packet send back
19 Linux Networking Lal Paul Routing ping Gw: Gw: Gw: Routing table > > Routing table > > Routing table > > Gw: && = Packet sent to Gateway
20 Linux Networking Lal Paul Ping Uses ICMP echo request/reply Source sends ICMP echo request message to the destination address Echo request packet contains sequence number and timestamp Destination replies with an ICMP echo reply message containing the data in the original echo request message Source can calculate round trip time (RTT) of packets If no echo reply comes back then the destination is unreachable Uses ICMP echo request/reply Source sends ICMP echo request message to the destination address Echo request packet contains sequence number and timestamp Destination replies with an ICMP echo reply message containing the data in the original echo request message Source can calculate round trip time (RTT) of packets If no echo reply comes back then the destination is unreachable
21 Linux Networking Lal Paul Ping (cont’d) R1R2R3 AB Time Echo request Echo reply
22 Linux Networking Lal Paul Traceroute Traceroute records the route that packets take A clever use of the TTL field When a router receives a packet, it decrements TTL If TTL=0, it sends an ICMP time exceeded message back to the sender To determine the route, progressively increase TTL Every time an ICMP time exceeded message is received, record the sender’s (router’s) address Repeat until the destination host is reached or an error message occurs Traceroute records the route that packets take A clever use of the TTL field When a router receives a packet, it decrements TTL If TTL=0, it sends an ICMP time exceeded message back to the sender To determine the route, progressively increase TTL Every time an ICMP time exceeded message is received, record the sender’s (router’s) address Repeat until the destination host is reached or an error message occurs
23 Linux Networking Lal Paul Traceroute (cont’d) R1R2R3 AB TTL=1, Dest = B, port = invalid TTL=2, Dest = B TTL=3, Dest = B TTL=4, Dest = B Te (R1) Te (R2) Te (R3) Pu (B) Time Te = Time exceeded Pu = Port unreachable
24 Linux Networking Lal Paul Traceroute Examle 1 lcsr-gw ( ) ms ms ms 2 rucs-gw ( ) ms ms ms 3 transition2-gw ( ) ms ms ms 4 rutgers-gw.Rutgers.EDU ( ) ms ms Vl1000-sr02-hil l012-svcs.Rutgers.EDU ( ) ms 5 rutgers-gw.Rutgers.EDU ( ) ms ms ms ( ) ms ms ms 7 clev-nycm.abilene.ucaid.edu ( ) ms ms ms 8 ipls-clev.abilene.ucaid.edu ( ) ms ms ms 9 kscy-ipls.abilene.ucaid.edu ( ) ms ms ms 10 dnvr-kscy.abilene.ucaid.edu ( ) ms ms ms 11 snva-dnvr.abilene.ucaid.edu ( ) ms ms ms ( ) ms ms ms 13 BERK--SUNV.POS.calren2.net ( ) ms ms ms 14 pos1-0.inr-000-eva.Berkeley.EDU ( ) ms ms ms 15 vlan198.inr-201-eva.Berkeley.EDU ( ) ms ms ms 16 fast8-0-0.inr-210-cory.Berkeley.EDU ( ) ms ms ms 17 GE.cory-gw.EECS.Berkeley.EDU ( ) ms ms ms 18 gig8-1.snr1.CS.Berkeley.EDU ( ) ms ms ms 19 now.CS.Berkeley.EDU ( ) ms * ms 1 lcsr-gw ( ) ms ms ms 2 rucs-gw ( ) ms ms ms 3 transition2-gw ( ) ms ms ms 4 rutgers-gw.Rutgers.EDU ( ) ms ms Vl1000-sr02-hil l012-svcs.Rutgers.EDU ( ) ms 5 rutgers-gw.Rutgers.EDU ( ) ms ms ms ( ) ms ms ms 7 clev-nycm.abilene.ucaid.edu ( ) ms ms ms 8 ipls-clev.abilene.ucaid.edu ( ) ms ms ms 9 kscy-ipls.abilene.ucaid.edu ( ) ms ms ms 10 dnvr-kscy.abilene.ucaid.edu ( ) ms ms ms 11 snva-dnvr.abilene.ucaid.edu ( ) ms ms ms ( ) ms ms ms 13 BERK--SUNV.POS.calren2.net ( ) ms ms ms 14 pos1-0.inr-000-eva.Berkeley.EDU ( ) ms ms ms 15 vlan198.inr-201-eva.Berkeley.EDU ( ) ms ms ms 16 fast8-0-0.inr-210-cory.Berkeley.EDU ( ) ms ms ms 17 GE.cory-gw.EECS.Berkeley.EDU ( ) ms ms ms 18 gig8-1.snr1.CS.Berkeley.EDU ( ) ms ms ms 19 now.CS.Berkeley.EDU ( ) ms * ms