拓扑如上
要求,全网互通,在R4上查看路由显示R5为域内路由。
配置如下:
首先,在SW1 ,SW2上划分VLAN并且把各个接口划分到VLAN下去。
SW1上配置如下:
RACK171SW1#vlan da
RACK171SW1(vlan)#vlan 34 name vlan34
RACK171SW1(vlan)#vlan 55 name vlan55
RACK171SW1(vlan)#exit
RACK171SW1(config)#int range f0/3 , f0/4
RACK171SW1(config-if-range)#sw ac vl 34
RACK171SW1(config-if-range)#int f0/5
RACK171SW1(config-if)#sw ac vl 55
RACK171SW1(config-if)#^Z
SW2上配置如下:
RACK171SW2#vlan da
RACK171SW2(vlan)#vlan 25 name vlan25
RACK171SW2(vlan)#exit
RACK171SW2(config)#int range f0/2 , f0/5
RACK171SW2(config-if-range)#sw ac vl 25
RACK171SW2(config-if-range)#no sh
RACK171SW2(config-if-range)#^Z
再分配各路由的各个接口IP地址,做帧中继,DHLC映射,保证直连互通。
R1上配置如下:
RACK171R1(config)#int lo0
RACK171R1(config-if)#ip add 123.123.1.1 255.255.255.0
RACK171R1(config-if)#int s2/0
RACK171R1(config-if)#ip add 123.123.123.1 255.255.255.0
RACK171R1(config-if)#no sh
RACK171R1(config-if)#en fr
RACK171R1(config-if)#no frame inver
RACK171R1(config-if)#fr map ip 123.123.123.2 102 b
RACK171R1(config-if)#fr map ip 123.123.123.3 103 b
RACK171R1(config-if)#fr map ip 123.123.123.1 102 b
RACK171R1(config-if)#int s3/0
RACK171R1(config-if)#ip add 14.14.14.1 255.255.255.0
RACK171R1(config-if)#no sh
RACK171R1(config-if)#en fr
RACK171R1(config-if)#no frame inver
RACK171R1(config-if)#fr map ip 14.14.14.4 114 b
RACK171R1(config-if)#ip ospf net point-to-p
R2上配置如下:
RACK171R2(config)#int lo0
RACK171R2(config-if)#ip add 123.123.2.2 255.255.255.0
RACK171R2(config-if)#int s2/0
RACK171R2(config-if)#ip add 123.123.123.2 255.255.255.0
RACK171R2(config-if)#no sh
RACK171R2(config-if)#en fr
RACK171R2(config-if)#no frame inver
RACK171R2(config-if)#fr map ip 123.123.123.1 201 b
RACK171R2(config-if)#fr map ip 123.123.123.3 201 b
RACK171R2(config-if)#ip ospf pri 0
RACK171R2(config-if)#int f1/0
RACK171R2(config-if)#ip add 25.25.25.2 255.255.255.0
RACK171R2(config-if)#no sh
RACK171R2(config-if)#full
RACK171R2(config-if)#^Z
R3上配置如下:
RACK171R3(config)#int lo0
RACK171R3(config-if)#ip add 123.123.3.3 255.255.255.0
RACK171R3(config-if)#int s2/0
RACK171R3(config-if)#ip add 123.123.123.3 255.255.255.0
RACK171R3(config-if)#no sh
RACK171R3(config-if)#en fr
RACK171R3(config-if)#no frame inver
RACK171R3(config-if)# fr map ip 123.123.123.1 301 b
RACK171R3(config-if)#fr map ip 123.123.123.2 301 b
RACK171R3(config-if)#ip ospf pri 0
RACK171R3(config-if)#int f0/0
RACK171R3(config-if)#ip add 34.34.34.3 255.255.255.0
RACK171R3(config-if)#no sh
RACK171R3(config-if)#full
RACK171R3(config-if)#^Z
R4上配置如下:
RACK171R4(config)#int lo0
RACK171R4(config-if)# ip add 14.14.4.4 255.255.255.0
RACK171R4(config-if)# int s3/0
RACK171R4(config-if)#ip add 14.14.14.4 255.255.255.0
RACK171R4(config-if)#no sh
RACK171R4(config-if)#en fr
RACK171R4(config-if)#no frame inver
RACK171R4(config-if)#fr map ip 14.14.14.1 411 b
RACK171R4(config-if)#ip ospf net point-to-p
RACK171R4(config-if)#int f0/0
RACK171R4(config-if)#ip add 34.34.34. 4 255.255.255.0
RACK171R4(config-if)#no sh
RACK171R4(config-if)#full
RACK171R4(config-if)#^Z
R5上配置如下:
RACK171R5(config)#int lo0
RACK171R5(config-if)#ip add 55.55.5.5 255.255.255.0
RACK171R5(config-if)#int f1/0
RACK171R5(config-if)#ip add 55.55.55.5 255.255.255.0
RACK171R5(config-if)#no sh
RACK171R5(config-if)#full
RACK171R5(config-if)#^Z.
RACK171R5(config)#int f0/0
RACK171R5(config-if)#ip add 55.55.55.5 255.255.255.0
RACK171R5(config-if)#no sh
RACK171R5(config-if)#full
RACK171R5(config-if)#^Z
启用OSPF,宣告各网段。
R1:
RACK171R1(config)#router ospf 123
RACK171R1(config-router)#nei 123.123.123.2 //指定邻居
RACK171R1(config-router)#nei 123.123.123.3
RACK171R1(config-router)#net 123.123.1.1 0.0.0.0 a 0
RACK171R1(config-router)#net 123.123.123.1 0.0.0.0 a 0
RACK171R1(config-router)#net 14.14.14.1 0.0.0.0 a 2
RACK171R1(config-router)#^Z
R2:
RACK171R2(config)#router ospf 123
RACK171R2(config-router)#net 123.123.2.2 0.0.0.0 a 0
RACK171R2(config-router)#net 123.123.123.2 0.0.0.0 a 0
RACK171R2(config-router)#net 25.25.25.2 0.0.0.0 a 5
RACK171R2(config-router)#^Z
R3:
RACK171R3(config)#router ospf 123
RACK171R3(config-router)#net 123.123.3.3 0.0.0.0 a 0
RACK171R3(config-router)#net 123.123.123.3 0.0.0.0 a 0
RACK171R3(config-router)#net 34.34.34.3 0.0.0.0 a 2
RACK171R3(config-router)#^Z
R4:
RACK171R4(config)#router ospf 123
RACK171R4(config-router)#net 34.34.34.4 0.0.0.0 a 2
RACK171R4(config-router)#net 14.14.14.4 0.0.0.0 a 2
RACK171R4(config-router)#net 14.14.14.1 0.0.0.0 a 2
RACK171R4(config-router)#^Z
R5:
RACK171R5(config)#router ospf 123
RACK171R5(config-router)#net 55.55.5.5 0.0.0.0 a 2
RACK171R5(config-router)#net 55.55.55.5 0.0.0.0 a 2
RACK171R5(config-router)#net 25.25.25.5 0.0.0.0 a 5
RACK171R5(config-router)#^Z
为了要在R4上查看路由表,显示R4是一条域内路由,需要从R1和R5之间搭建一条隧道。
R1上如下:
RACK171R1(config)#int tun 0
RACK171R1(config-if)#ip unn s3/0
RACK171R1(config-if)#tun so s3/0
RACK171R1(config-if)#tun des 55.55.55.5
RACK171R1(config-if)#^Z
R5上如下:
RACK171R5(config)#int tun 0
RACK171R5(config-if)#ip unn f0/0
RACK171R5(config-if)#tun so f0/0
RACK171R5(config-if)#tun des 14.14.14.1
*Jun 15 03:10:02.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
//可以看到R5上隧道已经启用。
RACK171R5(config-if)# ^Z
想不出,为什么R1上的隧道一直是DOWN状态。看不到路由翻动。
这样的配置,R4还是学不到路由的,因为隧道是建立在R5去往R4的下一跳是R1,就是R5→R2→R1