1. 程式人生 > 實用技巧 >VyOS和cisco交換機如何配置trunk

VyOS和cisco交換機如何配置trunk

VyOS和cisco交換機如何配置trunk

來源 https://zhuanlan.zhihu.com/p/136023638

參考 https://docs.vyos.io/en/latest/configuration/interfaces/ethernet.html?highlight=vlan#vlan

VyOS

set system host-name 'SW1'

set interfaces ethernet eth0 address '192.168.1.1/24'

set interfaces ethernet eth0 vif 10 address '192.168.10.1/24'
set interfaces ethernet eth0 vif 10 description 'vlan 10'

SW2

hostname SW2

vlan 1
vlan 10

interface Ethernet0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk

interface Vlan1
 ip address 192.168.1.2 255.255.255.0

interface Vlan10
 ip address 192.168.10.2 255.255.255.0

測試native vlan

vyos@SW1:~$ ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=0.507 ms
64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0.449 ms
  • native vlan 不打tag

測試vlan10

vyos@SW1:~$ ping 192.168.10.2
PING 192.168.10.2 (192.168.10.2): 56 data bytes
64 bytes from 192.168.10.2: icmp_seq=0 ttl=255 time=0.416 ms
64 bytes from 192.168.10.2: icmp_seq=1 ttl=255 time=0.391 ms
  • vlan 10,打tag10

======== End