需求:实现基本VLAN及Trunk配置,实现相同VLAN及不同VLAN之间的互联互通
关键配置:
1、配置VLAN,划分VLAN
SW1(config)#vlan 10,20
interface Ethernet0/0
switchport access vlan 10
switchport mode access
interface Ethernet0/1
switchport access vlan 20
switchport mode access
SW2同理配置,配置后show vlan brief 查看检查VLAN配置
2、Trunk干道配置
SW1和SW2之间配置
interface Ethernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
测试相同VLAN间互联互通正常
PC1#ping 192.168.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
!!!!!
PC2>ping 192.168.20.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.2, timeout is 2 seconds:
.!!!!
SW1上SVI虚拟接口配置
SW1(config)#interface vlan 10
SW1(config-if)#ip address 192.168.10.254 255.255.255.0
SW1(config-if)#int vlan 20
SW1(config-if)#ip address 192.168.20.254 255.255.255.0
PC1#ping 192.168.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
..!!!
背景: 为避免单点链路故障,需要实现链路冗余。
链路捆绑关键配置【PAGP模式】:
SW1(config)#interface range ethernet 0/2-3
SW1(config-if-range)#channel-group 10 mode desirable
SW2(config)#interface range ethernet 0/2-3
SW2(config-if-range)#channel-group 10 mode desirable
SW1(config)#interface port-channel 10
SW1(config-if)#switchport trunk encapsulation dot1q
SW2(config)#interface port-channel 10
SW2(config-if)#switchport trunk encapsulation dot1q
链路捆绑关键配置【LACP模式】:
SW1(config)#interface range ethernet 0/2-3
SW1(config-if-range)#channel-group 10 mode active
SW1(config)#interface range ethernet 0/2-3
SW2(config-if-range)#channel-group 10 mode active
测试: