![]() |
![]() |
两个三层交换机连接:
要求:
交换机建VLAN 开启路由ip routing
交换机接口默认为交换接口,可以关闭no sw ,同时开启路由
三层连接:添加静态路由ip route 1.0.0.0 255.0.0.0 5.5.5.100三层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
建立VLAN 10
Switch(config-if)#vlan 10
Switch(config-vlan)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
打开VLAN10端口
Switch(config-vlan)#int vlan 10
清除原有IP地址
Switch(config-if)#no ip addr
添加下级网络的网关IP地址
Switch(config-if)#ip addr 3.3.3.100 255.0.0.0
开启路由
Switch(config-if)#ip routingSwitch(config)#vlan 20
Switch(config-vlan)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-vlan)#int vlan 20
Switch(config-if)#no ip addr
Switch(config-if)#ip addr 4.4.4.100 255.0.0.0
Switch(config-if)#ip routing
Switch(config)#连接两个三层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
F0/24不能UP,所以删除线,连接F0/23
Switch(config-if)#int f0/24
Switch(config-if)#no ip addr
Switch(config-if)#int f0/23
Switch(config-if)#no ip addr
^
% Invalid input detected at '^' marker.
Switch(config-if)#no ip addr
^
% Invalid input detected at '^' marker.
关闭23端口的交换机功能,开启路由功能
Switch(config-if)#no sw
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
删除原有IP地址
Switch(config-if)#no ip addr
添加另一组IP地址
Switch(config-if)#ip addr 5.5.5.101 255.0.0.0
Switch(config-if)#no shut
添加静态路由
Switch(config-if)#ip route 1.0.0.0 255.0.0.0 5.5.5.101
%Invalid next hop address (it's this router)
Switch(config)#ip route 1.0.0.0 255.0.0.0 5.5.5.100
Switch(config)#ip route 2.0.0.0 255.0.0.0 5.5.5.100
Switch(config)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by consoleSwitch#sh ip route
S 1.0.0.0/8 [1/0] via 5.5.5.100
S 2.0.0.0/8 [1/0] via 5.5.5.100
C 3.0.0.0/8 is directly connected, Vlan10
C 4.0.0.0/8 is directly connected, Vlan20
C 5.0.0.0/8 is directly connected, FastEthernet0/23
Switch#