交换机基础配置之三层交换机实现vlan间通信
我们以上面的拓扑图做实验,要求为pc1,pc2,pc3配置为vlan10,pc4,pc5,pc6配置为vlan20,pc7,pc8,pc9配置为vlan30
server0和server1配置为vlan40,给各自vlan设置网关,实现三层交换机的跨交换机vlan通信,为求方便,我们先用到vtp,设置vtp域为qqq
首先给各个pc机和服务器设置好IP地址
先配置三层交换机switch1
enable 进入特权模式
configure terminal 进入全局配置模式
vtp domain qqq 设置域名
vtp mode server 设置为server
interface f0/1
switchport mode dynamic desirable
exit
vlan 10 创建好vlan
vlan 20
vlan 30
vlan 40
给vlan配置网关
interface vlan 10
ip address 192.168.1.254 255.255.255.0
exit
interface vlan 20
ip address 192.168.2.254 255.255.255.0
exit
interface vlan 30
ip address 192.168.3.254 255.255.255.0
exit
interface vlan 40
ip address 192.168.4.254 255.255.255.0
配置switch2
enable
configure terminal
vtp domain qqq
vtp mode client
interface f0/2
switchport mode access
switchport access vlan 30
exit
nterface f0/3
switchport mode access
switchport access vlan 20
exit
nterface f0/4
switchport mode access
switchport access vlan 10
exit
interface f0/2(设置server0的vlan)
switchport mode access
switchport access vlan 40
interface f0/3
switchport mode access
switchport access vlan 40
在配置switch3
enable
configure terminal
vtp domain qqq
vtp mode client
interface f0/2
switchport mode trunk
exit
interface f0/3
switchport mode trunk
exit
interface f0/4
switchport mode access
switchport access vlan 30
exit
nterface f0/5
switchport mode access
switchport access vlan 20
exit
nterface f0/6
switchport mode access
switchport access vlan 10
exit
配置switch4
enable
configure terminal
vtp domain qqq
vtp mode client
interface f0/2
switchport mode access
switchport access vlan 30
exit
nterface f0/3
switchport mode access
switchport access vlan 20
exit
nterface f0/4
switchport mode access
switchport access vlan 10
exit
现在vlan10的网关为192.168.1.254
成员为pc1,2,3
vlan20的网关为192.168.2.254
成员为4,5,6
vlan30的网关为192.168.3.254
成员为7,8,9
vlan40的网关为192.168.4.254
成员为server0,server1
现在就已经完成了三层交换机的vlan通信了