40
IP ROUTING STEVEN R. BAGLEY

STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

Embed Size (px)

Citation preview

Page 1: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

I P R O U T I N GS T E V E N R . B A G L E Y

Page 2: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

I N T R O D U C T I O N

• Looked at how we can route between networks

• Between separate ‘physical’ networks…

• Also known as packet forwarding

• Now going to look at how this is done on the Internet using IP

• Only going to consider IPv4

Page 3: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G

• Routing is hierarchical

• Only need to know how to reach a network, not each individual machine

• Routing only tells you the next hop to send the packet (not the complete path)

• Routing based entirely on the destination of the packet

• Gives source independence

• Stored in a routing table

Page 4: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

• The routing table should guarantee

• Universal Routing — there’s a next hop specified for every possible destination

• Optimal Routes — next hop should give the shortest path to the destination

• Helpful to use graphs to model networks

Shortest might not necessarily mean the smallest number of hops Several fast (high-bandwidth hops) might be quicker than one slow hop

Mathematical graph theory — not the charts we draw

Page 5: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

• IP also makes use of a routing table to direct packets

• Lists which is the next hop to take depending on the destination IP address

• Networks in the routing table specified in terms of an IP address on the network and a netmask

• Network address is the prefix part of the IP address

• Netmask just specifies which bits of the IP address are significant

• Next hop is specified as an IP address

e.g. the first 24 bits or whatever. Defined by the netmask

Next hop IP address must be directly accessible (i.e. on a network that hit machine is directly connected to)

Page 6: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

N E T M A S K A N D N E X T H O P

• Netmask can be used very simply to test to see if the IP is in a particular network

• Just AND the destination IP address, with the netmask for the network, bit by bit

• If the IP is in the network, the result will be equal to that network’s IP address AND netmask

• So the next hop for that IP would be the destination for that network…

Page 7: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 8: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 9: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 10: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 11: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 12: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 13: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 14: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

O U R I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 15: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.23.116

B I N A R Y 1000 0000 1111 0011 0001 0111 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

O U R I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two match, so the machine is on the same network and can send it directly

Page 16: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 17: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 18: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 19: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 20: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

D O T T E D D E C I M A L 128.243.21.0

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 21: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

D O T T E D D E C I M A L 128.243.21.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 22: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

D O T T E D D E C I M A L 128.243.21.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 23: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

D O T T E D D E C I M A L 128.243.21.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

O U R I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 24: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E S T I N AT I O N I PD O T T E D D E C I M A L 128.243.21.116

B I N A R Y 1000 0000 1111 0011 0001 0101 0111 0100

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

D E S T I N AT I O N I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0101 0000 0000

D O T T E D D E C I M A L 128.243.21.0

O U R I PD O T T E D D E C I M A L 128.243.23.15

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 1111

N E T M A S KD O T T E D D E C I M A L 255.255.255.0

B I N A R Y 1111 1111 1111 1111 1111 1111 0000 0000

O U R I P A N D N E T M A S K

B I N A R Y 1000 0000 1111 0011 0001 0111 0000 0000

D O T T E D D E C I M A L 128.243.23.0

Suppose we want to send something to 128.243.21.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0First, we apply the netmask to both addresses by ANDing itThen compare the result In this case the two don’t match, so the machine isn’t on that

Page 25: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

E X A M P L E

eth0 machine-a

eth0 machine-b

eth1 192.168.42.11

eth0……… 192.168.42.12

Two machines — each machine is connected to the local networkolivia also has a second ethernet connection to a raspberry PIOlivia can talk to both machines Jaylah can only talk to olivia — it has no connection to the raspberry PIPi can talk to olivia only — as only connected to that machine no routing to the wider internetUnless we setup some routesDemo setting routes and also showing how far packets get…

Page 26: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D E FA U LT R O U T E S

• Can often have a lot of routes that are identical

• Routing tables allow these to be specified by a default route

• This is used by default, unless there is a more specific route

• Can reduce the size of the routing table considerably…

• Specifies the route all traffic for which there is not a more direct route

• IP default route specified by the IP address 0.0.0.0 with a netmask 0.0.0.0

• This matches all possible destination IP addresses

Page 27: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 28: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 29: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

D E S T I N AT I O N N E T M A S K H O PN E T M A S K H O P N E X T H O P

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 30: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

D E S T I N AT I O N N E T M A S K H O PN E T M A S K H O P N E X T H O P

30.0.0.0 255.0.0.0255.0.0.0 40.0.0.7

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 31: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

D E S T I N AT I O N N E T M A S K H O PN E T M A S K H O P N E X T H O P

30.0.0.0 255.0.0.0255.0.0.0 40.0.0.7

40.0.0.0 255.0.0.0255.0.0.0 L O C A L

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 32: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

D E S T I N AT I O N N E T M A S K H O PN E T M A S K H O P N E X T H O P

30.0.0.0 255.0.0.0255.0.0.0 40.0.0.7

40.0.0.0 255.0.0.0255.0.0.0 L O C A L

128.1.0.0 255.255.0.0255.255.0.0 40.0.0.9

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 33: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

3 0 . 0 . 0 . 0

4 0 . 0 . 0 . 0 1 2 8 . 1 . 0 . 0

1 9 2 . 4 . 1 0 . 0

3 0 . 0 . 0 . 7

4 0 . 0 . 0 . 7

4 0 . 0 . 0 . 8

1 9 2 . 4 . 1 0 . 8 1 9 2 . 4 . 1 0 . 1

1 2 8 . 1 . 0 . 1

4 0 . 0 . 0 . 9

1 2 8 . 1 . 0 . 9

D E S T I N AT I O N N E T M A S K H O PN E T M A S K H O P N E X T H O P

30.0.0.0 255.0.0.0255.0.0.0 40.0.0.7

40.0.0.0 255.0.0.0255.0.0.0 L O C A L

128.1.0.0 255.255.0.0255.255.0.0 40.0.0.9

192.4.10.0 255.255.255.0255.255.255.0 L O C A L

Routers have different IP addresses in each networkCan be reached by using either of themBuild up a routing table on the white board for node 40.0.0.8

Page 34: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

R O U T I N G TA B L E

• How is the routing table constructed?

• Could program it in manually — doable for small networks

• Usually though it will be built up automatically by the router

• Two approaches — static and dynamic

Page 35: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

S TAT I C R O U T I N G TA B L E

• Static routing table constructed when the router boots

• Calculates possible routes to the different networks and fills in the table

• Doesn’t change until machine is rebooted…

• Simple approach, but inflexible

• Problem: cannot adapt to changes in the network (e.g. a link goes down)

• Would still try to send packets over the dead link

(or routes manually altered)Works for most home networks though!

Page 36: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

D Y N A M I C R O U T I N G TA B L E

• Program on router builds an initial routing table at boot

• Table updated as conditions on the network change

• Routers talk to each other informing them of changes

• More complex, but flexible and autonomous

• As routes fail, the system will route around them

Page 37: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

B U I L D I N G R O U T I N G TA B L E S

• But how is the table built?

• Software models the network as a graph

• Nodes are the networks, edges are the links between edges

• Each edge is given a weight

• Distance between two nodes is taken to be the sum of the paths between them

• Various algorithms, such as Dijkstra’s algorithm can be used to calculate the shortest paths

• Note it might not be the route you expect…

Page 38: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

B U I L D I N G R O U T I N G TA B L E

N E T W O R K 1

N E T W O R K 3 N E T W O R K 4

N E T W O R K 2

D E S T I N AT I O N N E X T H O P

1 L O C A L

5 1-5

* 1-3

N E T W O R K 1

D E S T I N AT I O N N E X T H O P

2 L O C A L

4 2-4

* 2-3

N E T W O R K 2

D E S T I N AT I O N N E X T H O P

2 3-2

3 L O C A L

4 3-4

* 3-1

N E T W O R K 3

D E S T I N AT I O N N E X T H O P

2 4-2

4 L O C A L

* 4-3

N E T W O R K 4

N E T W O R K 5

Given the following weights — it becomes clear that the route 3-2/2-3 is not optimal — much better to go via 2-4 and then 4-3 because it has a lower weight

Page 39: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

B U I L D I N G R O U T I N G TA B L E

N E T W O R K 1

N E T W O R K 3 N E T W O R K 4

N E T W O R K 2

D E S T I N AT I O N N E X T H O P

1 L O C A L

5 1-5

* 1-3

N E T W O R K 1

D E S T I N AT I O N N E X T H O P

2 L O C A L

4 2-4

* 2-3

N E T W O R K 2

D E S T I N AT I O N N E X T H O P

2 3-2

3 L O C A L

4 3-4

* 3-1

N E T W O R K 3

D E S T I N AT I O N N E X T H O P

2 4-2

4 L O C A L

* 4-3

N E T W O R K 4

1 10

2

2

N E T W O R K 5

2

Given the following weights — it becomes clear that the route 3-2/2-3 is not optimal — much better to go via 2-4 and then 4-3 because it has a lower weight

Page 40: STEVEN R. BAGLEY IP ROUTING - eprg.org · Suppose we want to send something to 128.243.23.116 and we are on machine with an interface with IP 128.243.23.15 and a netmask of 255.255.255.0

B U I L D I N G R O U T I N G TA B L E

N E T W O R K 1

N E T W O R K 3 N E T W O R K 4

N E T W O R K 2

1 10

2

2

N E T W O R K 5

2

Given the following weights — it becomes clear that the route 3-2/2-3 is not optimal — much better to go via 2-4 and then 4-3 because it has a lower weight