版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。
|
路由重分布配置
:
配置要求
:
<1>
设备要求
一台路由器连接两个路由域
,
也就是连接两个三层交换机
,
两台三层交换分别采用不同的路由协议
,switchA
采用
RIP
路由协议
,switchB
采用
ospf
路由协议
,
路由器同时采用两种不同的路由协议
,
路由器路由重分布实现两个三层交换的路由交换路由
!
<2>
配置命令
switchA>enable
switchA#config terminal
switchA(config)#vlan 10
switchA(config-vlan)#vlan 20
switchA(config-vlan)#exit
switchA(config)#interface vlan 10
switchA(config-if)#ip address 192.168.10.1 255.255.255.0
switchA(config-if)#no shut
switchA(config-if)#exit
switchA(config)#interface vlan 20
switchA(config-if)#ip address 192.168.20.1 255.255.255.0
switchA(config-if)#no shut
switchA(config-if)#exit
switchA(config)#interface f0/1
switchA(config-if)#no switchport
switchA(config-if)#ip address 192.168.1.1 255.255.255.0
switchA(config-if)#no shut
switchA(config-if)#exit
switchA(config)#interface f0/3
switchA(config-if)#switchport access vlan 10
switchA(config-if)#no shut
switchA(config-if)#exit
switchA(config)#interface f0/7
switchA(config-if)#switchport access vlan 20
switchA(config-if)#no shut
switchA(config-if)#exit
switchA(config)#router rip
switchA(config-router)#network 192.168.10.0
switchA(config-router)#network 192.168.20.0
switchA(config-router)#network 192.168.1.0
switchA(config-router)#version 2
switchA(config-router)#no auto-summary
switchA(config-router)#exit
switchA(config)#line vty 0 4
switchA(config-line)#login
switchA(config-line)#password 123456
switchA(config-line)#exit
switchA(config)#enable secret level 1 123456
switchA(config)#enable secret level 15 123456
switchA(config)#exit
switchA#end
switchB>enable
switchB#config terminal
switchB(config)#vlan 10
switchB(config-vlan)#vlan 20
switchB(config-vlan)#exit
switchB(config)#interface vlan 10
switchB(config-if)#ip address 192.168.30.1 255.255.255.0
switchB(config-if)#no shut
switchB(config-if)#exit
switchB(config)#interface vlan 20
switchB(config-if)#ip address 192.168.40.1 255.255.255.0
switchB(config-if)#no shut
switchB(config-if)#exit
switchB(config)#interface f0/1
switchB(config-if)#no switchport
switchB(config-if)#ip address 192.168.2.1 255.255.255.0
switchB(config-if)#no shut
switchB(config-if)#exit
switchB(config)#interface f0/3
switchB(config-if)#switchport access vlan 10
switchB(config-if)#no shut
switchB(config-if)#exit
switchB(config)#interface f0/7
switchB(config-if)#switchport access vlan 20
switchB(config-if)#no shut
switchB(config-if)#exit
switchB(config)#router ospf
switchB(config-router)#network 192.168.30.0 0.0.0 .255 area 0
switchB(config-router)#network 192.168.40.0 0.0.0 .255 area 0
switchB(config-router)#network 192.168.2.0 0.0.0 .255 area 0
switchB(config-router)#exit
switchB(config)#line vty 0 4
switchB(config-line)#login
switchB(config-line)#password 123456
switchB(config-line)#exit
switchB(config)#enable secret level 1 123456
switchB(config)#enable secret level 15 123456
switchB(config)#exit
switchB#end
router>enable
router#config terminal
router(config)#interface f1/0
router(config-if)#ip address 192.168.1.2 255.255.255.0
router(config-if)#no shut
router(config-router)#exit
router(config)#interface f1/1
router(config-if)#ip address 192.168.2.2 255.255.255.0
router(config-if)#no shut
router(config-if)#exit
router(config)#router rip
router(config-router)#network 192.168.1.0
router(config-router)#network 192.168.2.0
router(config-router)#version 2
router(config-router)#no auto-summary
router(config-router)#redistribute ospf metric 3//
设置路由重分布
,
将
rip
重分布到
ospf
中
router(config-router)#exit
router(config)#router ospf
router(config-router)#network 192.168.1.0 0.0.0 .255 area 0
router(config-router)#network 192.168.2.0 0.0.0 .255 area 0
router(config-router)#redistriblute rip subnets//
设置路由重分布
,
将
ospf
重分布到
rip
中
router(config-router)#exit
router(config)#line vty 0 4
router(config-line)#login
router(config-line)#password 123456
router(config-line)#exit
router(config)#enable secret level 1 123456
router(config)#enable secret level 15 123456
router(config)#exit
router#end
配置好后:三台设备的路由表情况如下:
Router:
Router#show ip route
Codes: C - connected, S - static, R - RIP B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is no set
C 192.168.1.0/24 is directly connected, FastEthernet 0/0
C 192.168.1.2/32 is local host.
C 192.168.2.0/24 is directly connected, FastEthernet 0/1
C 192.168.2.2/32 is local host.
R 192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0
R 192.168.20.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0
O 192.168.30.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEthernet 0/1
O 192.168.40.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEthernet 0/1
switchA:
switchA#show ip route
Codes: C - connected, S - static, R - RIP B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is no set
C 192.168.1.0/24 is directly connected, FastEthernet 0/1
C 192.168.1.1/32 is local host.
C 192.168.10.0/24 is directly connected, VLAN 10
C 192.168.10.1/32 is local host.
C 192.168.20.0/24 is directly connected, VLAN 20
C 192.168.20.1/32 is local host.
R 192.168.30.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0
R 192.168.40.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0
switchB:
switchB#show ip route
Codes: C - connected, S - static, R - RIP B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is no set
C 192.168.2.0/24 is directly connected, FastEthernet 0/1
C 192.168.2.1/32 is local host.
O E2 192.168.10.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthernet 0/1
O E2 192.168.20.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthernet 0/1
O E2 192.168.1.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthernet 0/1
C 192.168.40.0/24 is directly connected, VLAN 20
C 192.168.40.1/32 is local host.
根据上述的路由表的分析我们得知
rip
与
OSPF
的路由重分布成功。
|