OSPF下末节路由归纳虚拟链路配置
配置r1:
[r1]inter e0
[r1-Ethernet0]ip address 192.168.0.1 24
[r1-Ethernet0]loopback
Ethernet0 running on loopback mode
%01:02:23: Interface Ethernet0 is UP
%01:02:23: Line protocol ip on the interface Ethernet0 is UP
Duplicate IP Address
[r1-Ethernet0]ip address 192.168.1.1 24 sub
[r1-Ethernet0]ip address 192.168.2.1 24 sub
[r1-Ethernet0]ip address 192.168.3.1 24 sub
[r1-Ethernet0]ip address 192.168.4.1 24 sub
[r1-Ethernet0]ip address 192.168.5.1 24 sub
[r1-Ethernet0]ip address 192.168.6.1 24 sub
[r1-Ethernet0]ip address 192.168.7.1 24 sub
[r1-Ethernet0]inter s0
[r1-Serial0]ip address 192.168.8.1 24
[r1-Serial0]
%01:04:37: Line protocol ip on the interface Serial0 is UP
[r1-Serial0]quit
[r1]ospf enable
Start OSPF task...
OSPF enabled
[r1-ospf]inter e0
[r1-Ethernet0]ospf enable area 1
[r1-Ethernet0]inter s0
[r1-Serial0]ospf enable area 1
[r1-Serial0]quit
[r1]local-user user1 pass sim 123 servi adm
配置r2:
[r2]inter s0
[r2-Serial0]ip address 192.168.8.2 24
[r2-Serial0]inter s1
[r2-Serial1]ip address 192.168.9.1 24
[r2-Serial1]inter e0
[r2-Ethernet0]ip address 192.168.12.1 24
[r2]inter s0
[r2-Serial0]shut
% Interface Serial0 is shut down
[r2-Serial0]
%22:04:42: Interface Serial0 is DOWN
%22:04:42: Line protocol ip on the interface Serial0 is DOWN
[r2-Serial0]undo shut
[r2-Serial0]quit
[r2]ospf en
Start OSPF task...
OSPF enabled
[r2-ospf]inter s0
[r2-Serial0]ospf enable area 1
[r2-Serial0]inter s1
[r2-Serial1]ospf enable area 0
[r2-Serial1]quit
[r2]rip
waiting...
RIP is running
[r2-rip]network 192.168.12.0
[r2-rip]quit
[r2]local-user user1 password sim 123 ser adm
配置r3:
[r3]inter s0
[r3-Serial0]ip address 192.168.9.2 24
[r3-Serial0]inter s1
[r3-Serial1]ip address 192.168.10.1 24
[r3-Serial1]
%01:02:48: Line protocol ip on the interface Serial1 is UP
[r3-Serial1]int s0
[r3-Serial0]shut
% Interface Serial0 is down
%01:03:07: Interface Serial0 is DOWN
[r3-Serial0]undo shut
% Interface Serial0 is reset
%01:03:18: Interface Serial0 is UP
%01:03:18: Line protocol ip on the interface Serial0 is UP
[r3-Serial0]quit
[r3]ospf en
Start OSPF task...
OSPF enabled
[r3-ospf]inter s0
[r3-Serial0]ospf en area 0
[r3-Serial0]inter s1
[r3-Serial1]ospf en area 2
[r3-Serial1]quit
[r3]local-user user1 pass sim 123 ser adm
测试一下
[r3]ping 192.168.8.1
Reply from 192.168.8.1: bytes=56 Sequence=0 ttl=254 time = 50 ms
Reply from 192.168.8.1: bytes=56 Sequence=1 ttl=254 time = 50 ms
Reply from 192.168.8.1: bytes=56 Sequence=2 ttl=254 time = 50 ms
Reply from 192.168.8.1: bytes=56 Sequence=3 ttl=254 time = 50 ms
Reply from 192.168.8.1: bytes=56 Sequence=4 ttl=254 time = 52 ms
--- 192.168.8.1 ping statistics ---
5 packets transmitted
5 packets received
0.00% packet loss
round-trip min/avg/max = 50/50/52 ms
配置r4:
[r4]inter s0
[r4-Serial0]ip address 192.168.10.2 24
[r4-Serial0]inter e0
[r4-Ethernet0]ip address 192.168.11.1 24
[r4-Ethernet0]inter s0
[r4-Serial0]shut
[r4-Serial0]undo shut
% Interface Serial0 is reset
[r4-Serial0]
%01:02:40: Interface Serial0 is UP
%01:02:41: Line protocol ip on the interface Serial0 is UPquit
[r4]inter e0
[r4-Ethernet0]loopback
Ethernet0 running on loopback mode
[r4-Ethernet0]
[r4-Ethernet0]
%01:03:00: Interface Ethernet0 is UP
%01:03:00: Line protocol ip on the interface Ethernet0 is UP
[r4-Ethernet0]quit
[r4]ospf en
Start OSPF task...
OSPF enabled
[r4-ospf]inter s0
[r4-Serial0]ospf en area 2
[r4-Serial0]inter e0
[r4-Ethernet0]ospf en area 2
[r4-Ethernet0]quit
[r4]local-user user1 pass sim 123 ser adm
测试一下
[r4]ping 192.168.8.1
Reply from 192.168.8.1: bytes=56 Sequence=0 ttl=253 time = 74 ms
Reply from 192.168.8.1: bytes=56 Sequence=1 ttl=253 time = 78 ms
Reply from 192.168.8.1: bytes=56 Sequence=2 ttl=253 time = 74 ms
Reply from 192.168.8.1: bytes=56 Sequence=3 ttl=253 time = 74 ms
Reply from 192.168.8.1: bytes=56 Sequence=4 ttl=253 time = 83 ms
--- 192.168.8.1 ping statistics ---
5 packets transmitted
5 packets received
0.00% packet loss
配置r5:
[R5]vlan 10
[R5-vlan10]port e0/1
[R5-vlan10]inter vlan10
[R5-Vlan-interface10]ip address 192.168.12.2 255.255.255.0
[R5-Vlan-interface10]quit
[R5]vlan 20
[R5-vlan20]port e0/2
[R5-vlan20]inter vlan 20
[R5-Vlan-interface20]ip address 192.168.13.1 255.255.255.0
启动rip:
[R5]rip
[R5-rip]network 192.168.13.0
[R5-rip]network 192.168.12.0
退出时还有配置telnet
配置r6:(防火墙)
[r6]fire packet defau per
[r6]firewall zone trust
[r6-zone-trust]add inter e0/0
The interface has been added to trust security zone.
[r6-zone-trust]quit
[r6]fire zone untrust
[r6-zone-untrust]add inter e0/1
The interface has been added to trust security zone.
[r6-zone-untrust]quit
[r6]inter eth0/0
[r6-Ethernet0/0]ip address 192.168.13.2 24
[r6-Ethernet0/0]shut
[r6-Ethernet0/0]undo shut
[r6-Ethernet0/0]quit
[r6]inter eth0/1
[r6-Ethernet0/1]ip address 192.168.14.1 24
[r6-Ethernet0/1]loopback
[r6]rip
[r6-rip]network 192.168.14.0
[r6-rip]network 192.168.13.0
退出时还有配置telnet
[R5]dis ip rout
Routing Table: public net
Destination/Mask Protocol Pre Cost Nexthop Interface
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.0.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.1.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.2.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.3.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.4.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.5.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.6.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.7.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.8.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.9.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.10.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.11.0/24 RIP 100 1 192.168.12.1 Vlan-interface10
192.168.12.0/24 DIRECT 0 0 192.168.12.2 Vlan-interface10
192.168.12.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.13.0/24 DIRECT 0 0 192.168.13.1 Vlan-interface20
192.168.13.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.14.0/24 RIP 100 1 192.168.13.2 Vlan-interface20
末节区域:
[r3]ospf
[r3-ospf]stub cost 100 area 2
[r4-ospf]stub cost 100 area 2
在r4上查看路由表
[r4]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.0.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.1.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.2.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.3.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.4.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.5.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.6.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.7.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.8.0/24 OSPF 10 4686 192.168.10.1 Serial0
192.168.9.0/24 OSPF 10 3124 192.168.10.1 Serial0
192.168.10.0/24 Direct 0 0 192.168.10.1 Serial0
192.168.10.1/32 Direct 0 0 192.168.10.1 Serial0
192.168.10.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.11.0/24 Direct 0 0 192.168.11.1 Ethernet0
192.168.11.1/32 Direct 0 0 127.0.0.1 LoopBack0
完全末节区域;
[r3]ospf
[r3-ospf]undo stub cost 100 area 2
[r3-ospf]stub cost 100 area 2 ?
<cr>
no-summary Disallow summary LSA send into stub area
[r3-ospf]stub cost 100 area 2 no-summ
[r4]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.0/24 Direct 0 0 192.168.10.1 Serial0
192.168.10.1/32 Direct 0 0 192.168.10.1 Serial0
192.168.10.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.11.0/24 Direct 0 0 192.168.11.1 Ethernet0
192.168.11.1/32 Direct 0 0 127.0.0.1 LoopBack0
路由归纳:
[r2-ospf]abr 192.168.0.0 mask 255.255.248.0 area 1
[r3]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.0.0/21 OSPF 10 3134 192.168.9.1 Serial0
192.168.8.0/24 OSPF 10 3124 192.168.9.1 Serial0
192.168.8.1/32 O_ASE 150 1 192.168.9.1 Serial0
192.168.9.0/24 Direct 0 0 192.168.9.1 Serial0
192.168.9.1/32 Direct 0 0 192.168.9.1 Serial0
192.168.9.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.0/24 Direct 0 0 192.168.10.2 Serial1
192.168.10.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.2/32 Direct 0 0 192.168.10.2 Serial1
192.168.11.0/24 OSPF 10 1572 192.168.10.2 Serial1
192.168.12.0/24 O_ASE 150 1 192.168.9.1 Serial0
192.168.13.0/24 O_ASE 150 1 192.168.9.1 Serial0
192.168.14.0/24 O_ASE 150 1 192.168.9.1 Serial0
虚拟链路:
[r4-ospf]undo stub cost 100 area 2
R3上undo stub
先undoospf
[r3]ospf en
Start OSPF task...
OSPF enabled
[r3-ospf]inter s0
[r3-Serial0]ospf en area 1
[r2]int s0
[r2-Serial0]undo ospf en area 1
[r2-Serial0]ospf en area 0
[r2-Serial0]inter s1
[r2-Serial1]undo ospf en area 0
[r2-Serial1]ospf en area 1
[r1]int e0
[r1-Ethernet0]undo ospf en area 1
[r1-Ethernet0]ospf en area 0
[r1-Ethernet0]int s0
[r1-Serial0]undo ospf en area 1
[r1-Serial0]ospf en area 0
进入r3:
[r3]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.0.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.1.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.2.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.3.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.4.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.5.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.6.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.7.0/24 OSPF 10 3134 192.168.9.1 Serial0
192.168.8.0/24 OSPF 10 3124 192.168.9.1 Serial0
192.168.8.1/32 O_ASE 150 1 192.168.9.1 Serial0
192.168.9.0/24 Direct 0 0 192.168.9.1 Serial0
192.168.9.1/32 Direct 0 0 192.168.9.1 Serial0
192.168.9.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.0/24 Direct 0 0 192.168.10.2 Serial1
192.168.10.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.2/32 Direct 0 0 192.168.10.2 Serial1
192.168.11.0/24 OSPF 10 1572 192.168.10.2 Serial1
192.168.12.0/24 O_ASE 150 1 192.168.9.1 Serial0
[r4]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.10.0/24 Direct 0 0 192.168.10.1 Serial0
192.168.10.1/32 Direct 0 0 192.168.10.1 Serial0
192.168.10.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.11.0/24 Direct 0 0 192.168.11.1 Ethernet0
192.168.11.1/32 Direct 0 0 127.0.0.1 LoopBack0
查询rout id
[r3]dis ospf peer
Interface: 192.168.9.2 Area:
Neighbors:
RouterID: 192.168.8.2 Address: 192.168.9.1
State: Full Mode: Master Priority: 1
DR: None(ID) None(IP)
BDR: None(ID) None(IP)
Last Hello: 45:43 Last Exchange: 19:20
Interface: 192.168.10.1 Area:
Neighbors:
RouterID: 192.168.10.2 Address: 192.168.10.2
State: Full Mode: Slave Priority: 1
DR: None(ID) None(IP)
BDR: None(ID) None(IP)
Last Hello: 45:36 Last Exchange: 31:22
[r3]ospf
[r3-ospf]vlink peer-id 192.168.8.2 transit ?
<area_id> area's area id
[r3-ospf]vlink peer-id 192.168.8.2 transit 1
[r2]ospf
[r2-ospf]vlink peer-id 192.168.9.2 transit 1
192.168.12.0/24 O_ASE 150 1 192.168.10.1 Serial0
[r4]dis ip rout
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.0.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.1.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.2.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.3.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.4.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.5.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.6.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.7.0/24 OSPF 10 4696 192.168.10.1 Serial0
192.168.8.0/24 OSPF 10 4686 192.168.10.1 Serial0
192.168.8.1/32 O_ASE 150 1 192.168.10.1 Serial0
192.168.9.0/24 OSPF 10 3124 192.168.10.1 Serial0
192.168.9.2/32 O_ASE 150 1 192.168.10.1 Serial0
192.168.10.0/24 Direct 0 0 192.168.10.1 Serial0
192.168.10.1/32 Direct 0 0 192.168.10.1 Serial0
192.168.10.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.11.0/24 Direct 0 0 192.168.11.1 Ethernet0
192.168.11.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.12.0/24 O_ASE 150 1 192.168.10.1 Serial0
试验完成!