24
1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT

1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

Embed Size (px)

Citation preview

Page 1: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

1Linux Networking Lal Paul

IP Addressing & Routing

By

Lal PaulSystems Administrator

CIRM, CUSAT

IP Addressing & Routing

By

Lal PaulSystems Administrator

CIRM, CUSAT

Page 2: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

2Linux 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)

Page 3: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

3Linux Networking Lal Paul

32 bits long Notation:

Each byte is written in decimal in MSB order, separated by decimals

01101001.11111110.00010001.00000001

( 105.254.17.1 – in decimal notation)

IP Addresses

Page 4: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

4Linux Networking Lal Paul

IP Address ClassesIP Address Classes

Address ClassesClass A, B, C, D, ELoopbackBroadcast

Address ClassesClass A, B, C, D, ELoopbackBroadcast

Page 5: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

5Linux Networking Lal Paul

IP Address Classes

0 Net

32 bits

Type of Serv. Host

10 Net Host

110 Net Host

1110 Multicast address

11110 Reserved

A

B

C

D

E

Class

Page 6: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

6Linux 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

Page 7: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

7Linux Networking Lal Paul

IP Address Classes (Cont’d)IP Address Classes (Cont’d)

•Class DMulticast addresses

No network/host hierarchy : 1110, or 224 to 239 decimal.

•Class EFuture Use

begin with 1111, or 240 to 254 decimal.

Page 8: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

8Linux Networking Lal Paul

SubnetsSubnets

Large Network Large Network

Internet

Page 9: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

9Linux Networking Lal Paul

SubnetsSubnets

Departments after subnetting Departments after subnetting

192.168.1.0 192.168.2.0

192.168.3.0 192.168.4.0

A B

CD

Page 10: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

10Linux Networking Lal Paul

Subnet MasksSubnet 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.

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.

Page 11: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

11Linux Networking Lal Paul

Page 12: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

12Linux Networking Lal Paul

Page 13: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

13Linux Networking Lal Paul

Subnet MasksSubnet Masks

Assume your machine is 192.168.1.1 and has a subnet mask 255.255.255.0 and a packet is send to 192.168.1.2

How to find whether the destination host is on the same subnet or notAnding 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 192.168.1.1 and has a subnet mask 255.255.255.0 and a packet is send to 192.168.1.2

How to find whether the destination host is on the same subnet or notAnding 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

Page 14: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

14Linux Networking Lal Paul

Ping 192.168.3.1

192.168.1.1255.255.255.0

Net id192.168.2.0

192.168.3.1255.255.255.0

Net id192.168.2.0

192.168.2.1255.255.255.0

Net id192.168.2.0

192.168.3.1&&

255.255.255.0=

192.168.3.0(Net id)

Hence reject

192.168.3.1&&

255.255.255.0=

192.168.3.0(Net id)

Hence Accept

Page 15: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

15Linux Networking Lal Paul

2.3 IP Routing2.3 IP Routing

A B C D W X Y Z

?

How do you get a packet from one network to another?

Page 16: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

16Linux Networking Lal Paul

IP Routing (cont’d)IP Routing (cont’d)

A B C D W X Y Z

R

Answer: with a router (or a series of routers)

A B C D W X Y Z

R RNetworkCloud

Case 1:Single hop

Case 2:Multi-hop

Page 17: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

17Linux Networking Lal Paul

ExampleExample

N2N2 N3N3 N4N4

Actual routing table contains IP addresses, Flags Actual routing table contains IP addresses, Flags indicating type of entries, net mask etc. (see Stevens pg. indicating type of entries, net mask etc. (see Stevens pg. 113, sect 9.2)113, sect 9.2)

Routing table @ R2Routing table @ R2

N1N1

R1 R2 R3

N1N2N3N4

R1Deliver directlyDeliver directlyR3

Dest Next hop

Page 18: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

18Linux Networking Lal Paul

How packet travelsHow packet travels

192.168.1.0255.255.255.0

192.168.2.0255.255.255.0

192.168.3.0255.255.255.0

ping 192.168.3.2

192.168.2.2255.255.255.0

Gw:192.168.2.1

192.168.2.3255.255.255.0

Gw:192.168.2.1

10.0.0.1 10.0.0.2

10.0.0.3

192.168.1.1 192.168.2.1

192.168.3.1

192.168.1.2255.255.255.0

Gw:192.168.1.1

192.168.3.2255.255.255.0

Gw:192.168.3.1

192.168.3.2&&

255.255.255.0=

192.168.3.0

Packet sent to Gateway

No routePacket send back

Page 19: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

19Linux Networking Lal Paul

RoutingRouting

192.168.1.0255.255.255.0

192.168.2.0255.255.255.0

192.168.3.0255.255.255.0

ping 192.168.3.2

192.168.3.2255.255.255.0

Gw:192.168.3.1

192.168.2.2255.255.255.0

Gw:192.168.2.1

192.168.2.3255.255.255.0

Gw:192.168.2.1

Routing table192.168.1.0 -->

10.0.0.1192.168.3.0 -->

10.0.0.3 Routing table192.168.1.0 -->

10.0.0.1192.168.2.0 -->

10.0.0.2

10.0.0.1 10.0.0.2

10.0.0.3

192.168.1.1 192.168.2.1

192.168.3.1

Routing table192.168.2.0 -->

10.0.0.2192.168.3.0 -->

10.0.0.3

192.168.1.2255.255.255.0

Gw:192.168.1.1

192.168.3.2 && 255.255.255.0=192.168.3.0

Packet sent to Gateway

Page 20: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

20Linux Networking Lal Paul

PingPing

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

Page 21: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

21Linux Networking Lal Paul

Ping (cont’d)Ping (cont’d)

R1 R2 R3A B

Tim

e

Echo request

Echo reply

Page 22: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

22Linux Networking Lal Paul

TracerouteTraceroute

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

Page 23: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

23Linux Networking Lal Paul

Traceroute (cont’d)Traceroute (cont’d)

R1 R2 R3A B

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)

Tim

e

Te = Time exceededPu = Port unreachable

Page 24: 1 Linux Networking Lal Paul IP Addressing & Routing By Lal Paul Systems Administrator CIRM, CUSAT IP Addressing & Routing By Lal Paul Systems Administrator

24Linux Networking Lal Paul

Traceroute ExamleTraceroute Examle

1 lcsr-gw (128.6.13.21) 1.206 ms 0.973 ms 0.782 ms

2 rucs-gw (165.230.212.129) 0.697 ms 0.569 ms 0.571 ms

3 transition2-gw (165.230.12.145) 2.786 ms 0.994 ms 0.769 ms

4 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.726 ms 2.048 ms Vl1000-sr02-hil

l012-svcs.Rutgers.EDU (198.151.130.14) 1.278 ms

5 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.755 ms 1.241 ms 1.828 ms

6 198.151.130.226 (198.151.130.226) 2.748 ms 3.070 ms 2.640 ms

7 clev-nycm.abilene.ucaid.edu (198.32.8.29) 15.162 ms 14.619 ms 14.663 ms

8 ipls-clev.abilene.ucaid.edu (198.32.8.25) 21.220 ms 22.497 ms 21.450 ms

9 kscy-ipls.abilene.ucaid.edu (198.32.8.5) 30.257 ms 30.604 ms 30.969 ms

10 dnvr-kscy.abilene.ucaid.edu (198.32.8.13) 40.823 ms 41.181 ms 41.076 ms

11 snva-dnvr.abilene.ucaid.edu (198.32.8.1) 65.436 ms 66.068 ms 65.569 ms

12 198.32.249.161 (198.32.249.161) 65.673 ms 65.771 ms 66.006 ms

13 BERK--SUNV.POS.calren2.net (198.32.249.13) 67.183 ms 67.131 ms 66.858 ms

14 pos1-0.inr-000-eva.Berkeley.EDU (128.32.0.89) 67.192 ms 66.749 ms 67.720

ms

15 vlan198.inr-201-eva.Berkeley.EDU (128.32.0.194) 67.373 ms 67.067 ms 67.82

1 ms

16 fast8-0-0.inr-210-cory.Berkeley.EDU (128.32.255.122) 67.634 ms 68.735 ms

68.413 ms

17 GE.cory-gw.EECS.Berkeley.EDU (169.229.1.46) 67.575 ms 68.222 ms 67.772 ms

18 gig8-1.snr1.CS.Berkeley.EDU (169.229.3.66) 67.454 ms 67.988 ms 67.177 ms

19 now.CS.Berkeley.EDU (128.32.44.96) 67.892 ms * 67.818 ms

1 lcsr-gw (128.6.13.21) 1.206 ms 0.973 ms 0.782 ms

2 rucs-gw (165.230.212.129) 0.697 ms 0.569 ms 0.571 ms

3 transition2-gw (165.230.12.145) 2.786 ms 0.994 ms 0.769 ms

4 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.726 ms 2.048 ms Vl1000-sr02-hil

l012-svcs.Rutgers.EDU (198.151.130.14) 1.278 ms

5 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.755 ms 1.241 ms 1.828 ms

6 198.151.130.226 (198.151.130.226) 2.748 ms 3.070 ms 2.640 ms

7 clev-nycm.abilene.ucaid.edu (198.32.8.29) 15.162 ms 14.619 ms 14.663 ms

8 ipls-clev.abilene.ucaid.edu (198.32.8.25) 21.220 ms 22.497 ms 21.450 ms

9 kscy-ipls.abilene.ucaid.edu (198.32.8.5) 30.257 ms 30.604 ms 30.969 ms

10 dnvr-kscy.abilene.ucaid.edu (198.32.8.13) 40.823 ms 41.181 ms 41.076 ms

11 snva-dnvr.abilene.ucaid.edu (198.32.8.1) 65.436 ms 66.068 ms 65.569 ms

12 198.32.249.161 (198.32.249.161) 65.673 ms 65.771 ms 66.006 ms

13 BERK--SUNV.POS.calren2.net (198.32.249.13) 67.183 ms 67.131 ms 66.858 ms

14 pos1-0.inr-000-eva.Berkeley.EDU (128.32.0.89) 67.192 ms 66.749 ms 67.720

ms

15 vlan198.inr-201-eva.Berkeley.EDU (128.32.0.194) 67.373 ms 67.067 ms 67.82

1 ms

16 fast8-0-0.inr-210-cory.Berkeley.EDU (128.32.255.122) 67.634 ms 68.735 ms

68.413 ms

17 GE.cory-gw.EECS.Berkeley.EDU (169.229.1.46) 67.575 ms 68.222 ms 67.772 ms

18 gig8-1.snr1.CS.Berkeley.EDU (169.229.3.66) 67.454 ms 67.988 ms 67.177 ms

19 now.CS.Berkeley.EDU (128.32.44.96) 67.892 ms * 67.818 ms