思科:利用三层交换机实现vlan间路由

一、拓扑图

二、二层交换机的配置

Switch#
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit 
Switch(config)#int range fa0/1-2
Switch(config-if-range)#sw acc vlan 10
Switch(config-if-range)#exit 
Switch(config)#int range fa0/3-4
Switch(config-if-range)#sw acc vlan 20
Switch(config-if-range)#exit 
Switch(config)#int fa0/24
Switch(config-if)#sw mo trunk

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up

Switch(config-if)#end 
Switch#
%SYS-5-CONFIG_I: Configured from console by console

注释:

  1. 创建vlan
  2. 将接口接入vlan
  3. 开启通往三层交换机的trunk模式

三、三层交换机的配置

Switch>en
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit 
Switch(config)#int fa0/24
Switch(config-if)#sw tr encapsulation dot1q
Switch(config-if)#sw mo tr
Switch(config-if)#exit
Switch(config)#int vlan 10
Switch(config-if)#ip add 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#int vlan 20
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip routing

 注释:

  1. 创建vlan
  2.  配置trunk的封装类型

           把接口模式配置为trunk

     3.给vlan配置IP、子网掩码

        开启端口

     4、开启三层交换机的路由功能

四、给四台pc配置IP、子网掩码、网关

举例一个(另外三台如同)

五、用pc0ping通 pc2测试连通性

你的点赞是我最大的动力,

如有不懂可评论或私信,有问必有答。

猜你喜欢

转载自blog.csdn.net/qq_59718828/article/details/121431630
今日推荐