Download ppt

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Deep packet inspection wikipedia , lookup

Net bias wikipedia , lookup

Net neutrality law wikipedia , lookup

IEEE 1355 wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Network tap wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Distributed firewall wikipedia , lookup

Computer network wikipedia , lookup

Peering wikipedia , lookup

Airborne Networking wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Routing wikipedia , lookup

Transcript
CMPE 151
Routing
Marc Mosko
Talk Outline
 Routing basics
 Why segment networks?
 IP address/subnet mask
 The gateway decision based on dest IP address
 default gateway and static routing
 gateway discovery (DHCP, IDRP RFC1256)
 dynamic routing
 A simple routing protocol
 RIPv1
 All the problems w/ RIP
 quick RIPv2 differences
 Demo RIP
 commands: netstat, route, ip route
2
Why segment networks
 All systems see all others


Broadcast traffic causes load (ARP, etc.)
Security (e.g. block Windows file sharing)
 Over wide-area



Want to eliminate L2 broadcasts
Different administrative units want different
address spaces
L3 provides glue between different link
technologies, such as Ethernet and DSL.
3
Classful IP addresses
 5 classes
 A: 7-bit net/24-bit host
0xx
0 - 126
 Loopback
127
 B: 14-bit net/16-bit host
10x
128 - 191
 C: 21-bit net/8-bit host
110x
192 - 223
 D: multicast
1110x
224 - 239
 E: experimental
1111x
240 – 254
 Broadcast
255.255.255.255
 No subnet mask used. Bit-size of fields
defined by address prefix.
4
Classful examples
 A networks

10.1.2.3
net=10, host = 1.2.3
 B networks

172.16.8.7
net=172.16, host = 8.7
 C networks

192.168.4.5 net=192.168.4, host = 5
 D network

224.3.4.5
multicast group 224.3.4.5
5
Classful IP addresses
 What’s the problem?

Not enough networks






A = 125 usable
B = 16k usable
C = 2M usable
2M might seem like a lot, but is not enough for
whole world.
Point-to-point links would take up a whole class
C.
No one is going to put 16M hosts on a class A.
6
Enter Classless IP
 IP address is a 64-bit value: IP and mask.
 a.b.c.d / 255.255.255.0
 a.b.c.d / 24
 The mask specifies the network part of the address,
used by routers.
 What is left over (inverse mask) is used by hosts.
 Example: IP = 10.24.17.198 / 255.255.248.0
0A.18.11.C6
FF.FF.F8.00
0A.18.10.00
Network
Host
0A.18.11.C6
00.00.07.FF
00.00.01.C6
= 10.24.16.0
= 0.0.1.198
7
The gateway decision
 Host IP: 10.0.64.1 / 16
 Dest IP: 10.0.65.2
 What should host do with packet?



10.0.64.1 & 255.255.0.0 = 10.0.0.0
10.0.65.2 & 255.255.0.0 = 10.0.0.0
Same network, host should ARP and deliver
locally.
8
The gateway decision (2)
 Host IP: 10.0.64.1 / 16
 Dest IP: 10.1.65.2
 What should host do with packet?



10.0.64.1 & 255.255.0.0 = 10.0.0.0
10.1.65.2 & 255.255.0.0 = 10.1.0.0
Different network, host should send packet to
default gateway for routing.
9
Common masks
 Masks









255.255.255.0
255.255.255.128
255.255.255.192
255.255.255.224
255.255.255.240
255.255.255.248
255.255.255.252
255.255.255.254
255.255.255.255
0
0+128
128 + 64
192 + 32
224 + 16
240 + 8
248 + 4
252 + 2
254 + 1
/24
/25
/26
/27
/28
/29
/30
/31
/32
256 hosts
128 hosts
64 hosts
32 hosts
16 hosts
8 hosts
4 hosts
not usable
single host
 Learn them


There’s only 7 – just memorize it
Or, use the addition trick in column 2
10
Miscellaneous
 Reserved numbers
 Why is /31 not usable?
 0 = ``this net’’ and all-1s = broadcast
 In /30, 4 addresses, but only 2 usable, etc.
 Examples
 10.7.5.16/29 = 8 addresses, 6 usable
 10.7.5.16 = 0 ``this net’’ address
 10.7.5.23 = all-1s broadcast
 10.7.5.23 & 0.0.0.7
00010111
00000111 (inverse mask for host part)
.....111
 There are other rules about subnet zero (not
discussed)
11
IP address summary
 IP address & subnet mask




Hosts and routers know both.
Given IP, Mask, and destination IP, a host can
determine if local delivery or send to gateway.
The 0 and all-1s addresses reserved.
Just about everything is classless routing nowa-days.
12
Gateway discovery
 How does a host know which gateway?
 Static: put in /etc/gateways
 Simple, but not resilient to failures.
 DHCP/BOOTP
 Better administration, can be changed, but still
sensitive to gateway failure.
 IRDP (RFC 1256)
 Hosts can send a query to the network and available
gateways send responses.
 Allows automatic re-configuration around failures.
 Routing protocol
 Host can run a routing protocol and learn full routing
information. Can be a ``stub’’ that does not forward.
13
Dynamic routing
 What is a routing protocol?


Exchange reachability information
Prevent loops
Networks
at site
http://www.oreilly.com/catalog/iprouting/chapter/pipr_0401.gif
14
Routing Table
 Information stored (at minimum)
 Destination (likely w/ subnet mask)
 Next-hop to reach network
 Distance (or something else for loop-freedom)
 Status
Destination
172.16.50.0
172.16.250.0
172.16.252.0
172.16.1.0
192.168.1.0
172.16.100.0
172.16.251.0
Interface
E0
S0
S1
S0
S0
S1
S1
Nexthop
172.16.50.1
172.16.250.2
172.16.252.1
172.16.250.1
172.16.250.1
172.16.252.2
172.16.252.2
Distance
0
0
0
1
1
1
2
Chicago router
Status
CONN
CONN
CONN
UP
UP
UP
UP
Timer
---0:00:02
0:00:02
0:00:14
0:00:14
15
Routing table example
Destination
172.16.50.0
172.16.250.0
172.16.252.0
172.16.1.0
192.168.1.0
172.16.100.0
172.16.251.0
Interface
E0
S0
S1
S0
S0
S1
S1
Nexthop
172.16.50.1
172.16.250.2
172.16.252.1
172.16.250.1
172.16.250.1
172.16.252.2
172.16.252.2
Distance
0
0
0
1
1
1
2
Chicago router
Status
CONN
CONN
CONN
UP
UP
UP
UP
Timer
---0:00:02
0:00:02
0:00:14
0:00:14
16
A simple routing protocol
 Routing Information Protocol (RIP)
 Very old protocol (for computers!).
 Each node periodically broadcasts routing table out
each interface.
 For each received broadcast, for each destination, pick
next hop that has the shortest distance.
 Distance is from 0 to 15.
 Distance 16 = infinity (not reachable).
 RIP is in the class of:
 Distributed Bellman-Ford
 Distance Vector
17
RIP and subnet mask
 Does not use subnet masks
 Exception: If the router is configured with a subnet
mask, it will assume that mask for the network.
 In picture, 172.16.0.0 is class B. But is being used as
a class C. As long as all routers have /24 mask, RIP
will “do the right thing”.
18
Problems with RIP (1)
 Based on hop count

NY would choose 56k line to reach Ames
because it is 1 hop. The 2-hop T1 lines (1.5
Mbps) would be better.
19
Problems with RIP (2)
 Loops
failure
failure
Net 1
Time
1
30
60
70
90
120
150
…
510
540
Router A
Dist
NH
0
self
0
self
0
self
failure
failure
failure
failure
A
Router B
Dist
NH
-1
A
1
A
1
A
3
C
3
C
5
C
…
15
C
16
C
B
Route C
Dist
NH
--2
B
2
B
2
B
4
B
4
B
…
16
B
16
B
C
20
Problems with RIP (3)
 What would fix problem?
 Don’t advertise out I/F what you get in I/F (split horizon)
 When change to NH, send advert right away
 If I/F goes down, poison route (poison reverse)
Router A
Dist
NH
0
self
0
self
0
self
failure
failure
failure
failure
Time
1
30
60
70
90
120
150
…
510
540
Net 1
failure
failure
A
Router B
Dist
NH
-1
A
1
A
1
A
3
C
3
C
5
C
…
15
C
16
C
B
Route C
Dist
NH
--2
B
2
B
2
B
4
B
4
B
…
16
B
16
B
C
21
Problems with RIP (4)
 Summary
 Count-to-infinity




It is built in to RIP.
You cannot completely remove it.
It is in by design. RIP does not exchange enough
information to be loop-free in all cases, so it must
detect loops by C2I.
Split-horizon & poison reverse


Only work for short loops.
You can still have long cycles with loops, which
C2I will eventually remove.
22
RIP version 2 (RIPv2)
 Add subnet masks
 Triggered updates (faster convergence)
 Authentication
 Still has loops and C2I
 Is used today in small networks
23
RIP Demo
192.168.2.0/24
modesto
192.168.4.0/24
fresno
.1
turlock
192.168.3.0/24
.2
switch
192.168.11.0/24
PC
24
UNIX routing support




routed = RIP
mrouted = multicast DVMRP
Gated and Zebra = modern protocols
Commands






route add
ip route (linux)
netstat –nr
arp -a
route –nv monitor
/etc/gateways
25
Other topics (whiteboard)
 Distance vector vs. link state
 OSPF
 Can DV be loop free? (yes!)
 What is BGP4?
 Fault-tolerant network design
 Two NICs in server
 Two switches
 Two Routers
 Two ISPs
 How to make it all work together?
26