利用三层交换机实现VLAN间路由

 时间:2026-02-15 20:26:05

1、配置计算机PC0:

IP:   192.168.1.2

Submark:  255.255.255.0

Gateway:  192.168.1.1

利用三层交换机实现VLAN间路由

2、配置计算机PC1:

IP:   192.168.2.2

Submark:  255.255.255.0

Gateway:  192.168.2.1

利用三层交换机实现VLAN间路由

3、配置计算机PC2:

IP:   192.168.1.3

Submark:  255.255.255.0

Gateway:  192.168.1.1

利用三层交换机实现VLAN间路由

4、测试连通性:

1、PC0 Ping PC2

2、PC0Ping PC1       

利用三层交换机实现VLAN间路由

利用三层交换机实现VLAN间路由

5、配置二层交换机。

Switch>en

Switch#conf t

Switch(config )#vlan 2

Switch(config-vlan)#exit

Switch(config )#vlan 3

Switch(config-vlan)#exit

Switch(config )#int fa 0/2

Switch(config-if)#switchport access vlan 2

Switch(config-if)#exit

Switch(config )#int fa 0/3

Switch(config-if)#switchport access vlan 3

Switch(config-if)#exit

Switch(config )#int fa 0/1

Switch(config-if)#switchport  mode  trunk

Switch(config-if)#end

Switch#show vlan

利用三层交换机实现VLAN间路由

6、配置三层交换机。

Switch>en

Switch#conf t

Switch(config )#vlan 2  //新建vlan 2

Switch(config-vlan)#exit

Switch(config )#vlan 3  //新建vlan 3

Switch(config-vlan)#exit

Switch(config )#int fa 0/1  //进入0模块第1端口

Switch(config-if)#switchport trunk encapsulation dot1q //给这个接口的trunk封装为802.1Q的帧格式

Switch(config-if)#switchport mode trunk  //定义这个接口的工作模式为trunk

Switch(config-if)#exit

Switch(config )#int fa 0/2   //进入0模块第2端口

Switch(config-if)#switchport access vlan 2  //当前端口加入vlan 2

Switch(config-if)#exit

Switch(config )#interface vlan 2  //进入vlan2 虚拟接口

Switch(config-if)#ip address 192.168.1.1 255.255.255.0  //配置IP地址

Switch(config-if)#no shutdown  //开启该端口

Switch(config-if)#exit

Switch(config )#interface vlan 3

Switch(config-if)#ip address 192.168.2.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#end

Switch#show ip route  //显示路由表

Switch#show vlan   //显示vlan信息

利用三层交换机实现VLAN间路由

7、测试连通性:

1、PC0 Ping PC2

2、PC0Ping PC1       

利用三层交换机实现VLAN间路由

  • 虚拟机如何添加硬盘
  • sqli-labs第八关分析
  • 如何配置动态路由OSPF实验?
  • Centos7常用的系统命令
  • hyper-v虚拟机安装kali
  • 热门搜索
    丰宁坝上草原旅游 韩国旅游被叫停 止锚湾旅游 大连康辉旅游网 温州有什么旅游景点 云南双廊旅游攻略 重庆市旅游局官网 西安有什么旅游景点 沙美岛旅游攻略 布宜诺斯艾利斯旅游