没有你需要的三层交换配置类型,评论区留言,博主第一时间补充。
说明:交换机统一为S3700,连接线为Ethernet
目录
一、最简形式
system-view
undo info-center enable
vlan 10
vlan 20
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
验证实验结果pc1 :ping 192.168.20.2
二、一交换机、多主机
实验要求:同一vlan互通、PC1和PC3、PC2和PC4互通
不同vlan间PC1和PC2互通,PC3和PC4不互通
//复制上一文代码,并增加下列代码
interface Ethernet0/0/3
port link-type access
port default vlan 10
interface Ethernet0/0/4
port link-type access
port default vlan 20
若PC3想访问三层ping通valn2的主机(PC2、PC4)
添加网关 192.168.10.254
若PC4想访问三层ping通valn1的主机(PC1、PC3)
添加网关 192.168.20.254
三、三层交换机,二层交换机
实验要求:PC1和PC2vlan间互访
PC1和PC2的配置与最简形式相同
/************LSW1配置*************/
system-view
undo info-center enable
vlan 10
vlan 20
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
/************LSW2配置*************/
system-view
undo info-center enable
vlan 10
vlan 20
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
四、两台三层交换机
方法1:每台交换机都有vlanif 10 vlanif 20 地址
方法2:交换机通过vlan30来实现互访
方法1:
//复制上文代码,增加下列代码
/************LSW2配置*************/
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
方法2:
//复制上文代码,增加下列代码
/************LSW1配置*************/
vlan 30
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 30
quit
ip route-static 192.168.20.0 24 vlanif 30 192.168.30.253
/************LSW1配置*************/
vlan 30
interface Vlanif30
ip address 192.168.30.253 255.255.255.0
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 30
quit
ip route-static 192.168.10.0 24 vlanif 30 192.168.30.254