思科: trunk: 接口的配置同时存在access vlan 与trunk,哪个先生效,答案:trunk生效
思科: trunk: 接口的配置同时存在access vlan 与trunk,哪个先生效,答案:trunk生效
现象:
interface GigabitEthernet0/1
switchport access vlan 12
switchport trunk encapsulation dot1q
switchport mode trunk
结论:起用的为是tunk。
(1)拓扑图
(2)基本配置
sw1:
vlan 11
vlan 12
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
interface Vlan11
ip address 192.168.11.1 255.255.255.0
!
interface Vlan12
ip address 192.168.12.1 255.255.255.0
sw2:
vlan 11
vlan 12
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
interface Vlan11
ip address 192.168.11.2 255.255.255.0
!
interface Vlan12
ip address 192.168.12.2 255.255.255.0
测试:
sw1#ping 192.168.11.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/23/41 ms
sw1#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/21/41 ms
sw1#
sw2#ping 192.168.11.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/21/38 ms
sw2#
sw2#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/32/64 ms
sw2#
(3)在trunk接口上添加命令switchport access vlan 12,起作用的是trunk
sw1(config)#int g0/1
sw1(config-if)#sw ac
sw1(config-if)#sw access vl
sw1(config-if)#sw access vlan 12
查看sw1:
interface GigabitEthernet0/1
switchport access vlan 12
switchport trunk encapsulation dot1q
switchport mode trunk
测试:
sw1#ping 192.168.11.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/23/41 ms
sw1#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/21/41 ms
sw1#
sw2#ping 192.168.11.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/21/38 ms
sw2#
sw2#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/32/64 ms
sw2#
(3)在access接口上添加命令switchport mode trunk,起作用的是trunk
interface GigabitEthernet0/1
switchport access vlan 12
switchport mode access
sw1(config)#int g0/1
sw1(config-if)#switchport trunk encapsulation dot1q
!思科有些版本是需要配置封装encapsulation后,才能把模式修改成trunk
sw1(config-if)#switchport mo trunk
查看:
interface GigabitEthernet0/1
switchport access vlan 12
switchport trunk encapsulation dot1q
switchport mode trunk
测试:
sw1#ping 192.168.11.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/23/41 ms
sw1#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/21/41 ms
sw1#
sw2#ping 192.168.11.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/21/38 ms
sw2#
sw2#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/32/64 ms
sw2#
VLAN、接口的链路类型 (列表、list、全)vlanlist、accesslist、trunklist、hybridlist
http://www.zh-cjh.com/wenzhangguilei/1493.html
文章归类、所有文章列表、LISTLIST
http://www.zh-cjh.com/wangzhangonggao/2195.html
2、本资源基本为原创,部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
3、本站大部分文章的截图来源实验测试环境,请不要在生产环境中随意模仿,以免带来灾难性后果。
转载请保留出处: www.zh-cjh.com珠海陈坚浩博客 » 思科: trunk: 接口的配置同时存在access vlan 与trunk,哪个先生效,答案:trunk生效
作者: cjh
手机扫一扫,手机上查看此文章: |
一切源于价值!
其他 模板文件不存在: ./template/plugins/comment/pc/index.htm