PT routing

De teoretiska grunder om routing tillämpas i nätverkstopologin nedan. Vid frågor kan du alltid bläddra tillbaka och läsa om classful och classless routing.

Nätverkstopologi

Classful routing

  • Router: 1841 med modul: HWIC-2T
  • Switch: 2960
  • R1 Fa0/0 172.16.3.1/24 och Se0/0/0 172.16.2.1/24
  • R2 Fa0/0 172.16.1.1/24, Se0/0/0 172.16.2.2/24 och Se0/0/1 192.168.1.2/24
  • R3 Fa0/0 192.168.2.1/24 och Se0/0/1 192.168.1.1/24
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R1
  • R1(config)# interface fa0/0
  • R1(config-if)# description Connected to LAN
  • R1(config-if)# ip address 172.16.3.1 255.255.255.0
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# interface Se0/0/0
  • R1(config-if)# description DCE connected to R2
  • R1(config-if)# clock rate 128000
  • R1(config-if)# ip address 172.16.2.1 255.255.255.0
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.2
  • R1(config)# ip route 192.168.1.0 255.255.255.0 172.16.2.2 
  • R1(config)# ip route 192.168.2.0 255.255.255.0 172.16.2.2
  • R1# show interface ip brief
  • R1# show running-config
  • R1# show ip route static
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R2
  • R2(config)# interface fa0/0
  • R2(config-if)# description Connected to LAN
  • R2(config-if)# ip address 172.16.1.1 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# interface Se0/0/0
  • R2(config-if)# description Connected to R1
  • R2(config-if)# ip address 172.16.2.2 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# interface Se0/0/1
  • R2(config-if)# description DCE connected to R3
  • R2(config-if)# clock rate 128000
  • R2(config-if)# ip address 192.168.1.2 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# ip route 172.16.3.0 255.255.255.0 172.16.2.1
  • R2(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.1
  • R2# show interface ip brief
  • R2# show running-config
  • R2# show ip route static
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R3
  • R3(config)# interface fa0/0
  • R3(config-if)# description Connected to LAN
  • R3(config-if)# ip address 192.168.2.1 255.255.255.0
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# interface Se0/0/1
  • R3(config-if)# description Connected to R2
  • R3(config-if)# ip address 192.168.1.1 255.255.255.0
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# ip route 172.16.1.0 255.255.255.0 192.168.1.2
  • R3(config)# ip route 172.16.2.0 255.255.255.0 192.168.1.2
  • R3(config)# ip route 172.16.3.0 255.255.255.0 192.168.1.2
  • R3# show interface ip brief
  • R3# show running-config
  • R3# show ip route static
  • R3> enable
  • R3# configure terminal
  • R3(config)# no ip route 172.16.1.0 255.255.255.0 192.168.1.2
  • R3(config)# no ip route 172.16.2.0 255.255.255.0 192.168.1.2
  • R3(config)# no ip route 172.16.3.0 255.255.255.0 192.168.1.2
  • R3(config)# ip route 172.16.0.0 255.255.240.0 192.168.1.2
  • R1> enable
  • R1# configure terminal
  • R1(config)# no ip route 172.16.1.0 255.255.255.0 172.16.2.2
  • R1(config)# no ip route 192.168.1.0 255.255.255.0 172.16.2.2 
  • R1(config)# no ip route 192.168.2.0 255.255.255.0 172.16.2.2
  • R1(config)# ip route 0.0.0.0  0.0.0.0  172.16.2.2

Classless routing med RIP

  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R1
  • R1(config)# interface fa0/0
  • R1(config-if)# description Connected to LAN
  • R1(config-if)# ip address 172.16.3.1 255.255.255.0
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# interface Se0/0/0
  • R1(config-if)# description DCE connected to R2
  • R1(config-if)# clock rate 128000
  • R1(config-if)# ip address 172.16.2.1 255.255.255.0
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# router rip
  • R1(config-router)# version 2
  • R1(config-router)# no auto-summary
  • R1(config-router)# network 172.16.3.0
  • R1(config-router)# network 172.16.2.0
  • R1(config-router)# end
  • R1# show interface ip brief
  • R1# show ip interface brief
  • R1# show ip route
  • R1# show ip route rip
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R2
  • R2(config)# interface fa0/0
  • R2(config-if)# description Connected to LAN
  • R2(config-if)# ip address 172.16.1.1 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# interface Se0/0/0
  • R2(config-if)# description Connected to R1
  • R2(config-if)# ip address 172.16.2.2 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# interface Se0/0/1
  • R2(config-if)# description DCE connected to R3
  • R2(config-if)# clock rate 128000
  • R2(config-if)# ip address 192.168.1.2 255.255.255.0
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# router rip
  • R2(config-router)# version 2
  • R2(config-router)# no auto-summary
  • R2(config-router)# network 172.16.1.0
  • R2(config-router)# network 172.16.2.0
  • R2(config-router)# network 192.168.1.0
  • R2(config-router)# end
  • R2# show interface ip brief
  • R2# show running-config
  • R2# show ip route
  • R2# show ip route rip
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R3
  • R3(config)# interface fa0/0
  • R3(config-if)# description Connected to LAN
  • R3(config-if)# ip address 192.168.2.1 255.255.255.0
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# interface Se0/0/1
  • R3(config-if)# description Connected to R2
  • R3(config-if)# ip address 192.168.1.1 255.255.255.0
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# router rip
  • R3(config)# version 2
  • R3(config)# no auto-summary
  • R3(config-router)# network 192.168.1.0
  • R3(config-router)# network 192.168.2.0
  • R3# show interface ip brief
  • R3# show running-config
  •  R3# show ip route
  • R3# show ip route rip

Till R1 är direkt anslutna två nätverk: 172.16.3.0/24 och 172.16.2.0/24. R1 saknar uppgifter om tre nätverk: 172.16.1.0/24, 192.168.1.0/24, och 192.168.2.0/24

R1#show ip route rip
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.1.0 [120/1] via 172.16.2.2, 00:00:00, Serial0/0/0
R 192.168.1.0/24 [120/1] via 172.16.2.2, 00:00:00, Serial0/0/0
R 192.168.2.0/24 [120/2] via 172.16.2.2, 00:00:00, Serial0/0/0

Till R2 är direkt anslutna tre nätverk: 172.16.1.0/24, 172.16.2.0/24, och 192.168.1.0/24. R2 saknar uppgifter om två nätverk: 172.16.3.0/24 och 192.168.2.0/24

R2#show ip route rip
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.3.0 [120/1] via 172.16.2.1, 00:00:12, Serial0/0/0
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:00, Serial0/0/1

Till R3 är direkt anslutna två nätverk: 192.168.1.0/24 och 192.168.2.0/24. R3 saknar uppgifter om tre nätverk: 172.16.1.0/24, 172.16.2.0/24, och 172.16.3.0/24

R3#show ip route rip
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.1.0 [120/1] via 192.168.1.2, 00:00:10, Serial0/0/1
R 172.16.2.0 [120/1] via 192.168.1.2, 00:00:10, Serial0/0/1
R 172.16.3.0 [120/2] via 192.168.1.2, 00:00:10, Serial0/0/1

 

 

R1#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 1 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Serial0/0/0 2 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
172.16.2.2 120 00:00:28
Distance: (default is 120)
R1#