配置三层交换机实现不同区域网连通
1、配置R1三层交换机端口的地址信息
Switch>en
Switch#configter
Enterconfiguration commands, one per line. End with CNTL/Z.
Switch(config)#hostnameR1
R1(config)#interface fa0/1
R1(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/1, changed state to up
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#interface fa0/24
R1(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/24, changed state to up
R1(config-if)#ip add 172.16.2.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#end
R1#
%SYS-5-CONFIG_I:Configured from console by console
配置R2三层交换机端口的地址信息
Switch#config ter
Enterconfiguration commands, one per line. End with CNTL/Z.
Switch(config)#hostnameR2
R2(config)#interface fa0/1
R2(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/1, changed state to up
R2(config-if)#ip add 172.16.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#interface fa0/24
R2(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceFastEthernet0/24, changed state to up
R2(config-if)#ip add 172.16.3.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#end
R2#
%SYS-5-CONFIG_I:Configured from console by console
2、配置三层交换机设备RIPv2动态技术。
配置R1三层交换机
R1#configter
Enterconfiguration commands, one per line. End with CNTL/Z.
R1(config)#routerrip
R1(config-router)#version2
R1(config-router)#network172.16.1.0
R1(config-router)#network172.16.2.0
R1(config-router)#end
R1#
配置R1三层交换机
R2#configter
Enterconfiguration commands, one per line. End with CNTL/Z.
R2(config)#routerrip
R2(config-router)#version2
R2(config-router)#network172.16.1.0
R2(config-router)#network172.16.3.0
R2(config-router)#end
R2#
%SYS-5-CONFIG_I:Configured from console by console
测试R2,其信息如下:
R2#showip route
Codes: C- connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 -OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPFexternal type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 -IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-userstatic route, o - ODR
P - periodic downloaded static route
Gatewayof last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected,FastEthernet0/1
R 172.16.2.0 [120/1] via 172.16.1.1, 00:00:24,FastEthernet0/1
C 172.16.3.0 is directly connected,FastEthernet0/24
R2#
3、测试网络连通性PC1向PC2发送信息如下,
发现仍然ping不通,经请教别人,发现以上设置,还没有开启三层交换机的路由功能
4、R2(config)#?
不停的按空格键,来获取三层交换机的各种信息,得知没有路由信息。
5、ip routing 启用IP路由功能后,便能实验成功。