VyOS の trunk 設定

# Arista の vEOS と VyOS で trunk 設定をしてみる

VMware Workstation の中に作ってみる。
- 管理 PC から接続する LAN は VMnet の「ホストオンリー」で接続
- Swirch 間は「LANセグメント」で接続
- VyOS は L2 スイッチ扱い


![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/306041/cd0384d0-150f-8402-3a1d-220dbc016848.png)

パスワードは取りあえず　Pass で。
```configuration:vEOS-11
vEOS-11#show running-config
! Command: show running-config
! device: vEOS-11 (vEOS-lab, EOS-4.31.0F)
!
! boot system flash:/vEOS-lab.swi
!
no aaa root
!
username admin role network-admin secret sha512 $6$TXiLk9Ch4NP2wMDV$ZaJPMFgFzs4uXBDNd5jizFBPeUVvRUV5iYSQ3Lt0YMgzVnJmkqNybQk2INI69eADlCs4qRokgeVQpMsKScHTV1
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname vEOS-11
!
spanning-tree mode none
!
system l1
   unsupported speed action error
   unsupported error-correction action error
!
vlan 100,110,120
!
vrf instance MANAGE
!
interface Ethernet1
   no switchport
   ip address 172.16.0.11/24
!
interface Ethernet2
   switchport trunk allowed vlan 1,100,110,120
   switchport mode trunk
   spanning-tree portfast
!
interface Ethernet3
   switchport trunk allowed vlan 1,100,110,120
   switchport mode trunk
   spanning-tree portfast
!
interface Management1
   vrf MANAGE
   ip address 172.30.10.11/24
!
interface Vlan1
   ip address 192.168.10.11/24
!
interface Vlan100
   ip address 10.0.100.11/24
!
interface Vlan110
   ip address 10.0.110.11/24
!
interface Vlan120
   ip address 10.0.120.11/24
!
ip routing
no ip routing vrf MANAGE
!
ntp server vrf MANAGE 172.30.10.254 iburst
!
end
vEOS-11#
```

VyOS の場合、vlan は複数のインターフェースにまたがるため bridge interface に設定する。
複数の vlan がある場合、1つの bridge interface に全ての vlan を書いて、物理 interface に allowed-vlan で通してやる。
vlan 毎に bridge interface を作成しても良いが、interface の数が多くなってしまう。

```configuration:VyOS-12
vyos@VyOS-12:~$ show configuration commands
set interfaces bridge br0 address '192.168.10.12/24'
set interfaces bridge br0 enable-vlan
set interfaces bridge br0 member interface eth1 allowed-vlan '1'
set interfaces bridge br0 member interface eth1 allowed-vlan '100'
set interfaces bridge br0 member interface eth1 allowed-vlan '110'
set interfaces bridge br0 member interface eth1 allowed-vlan '120'
set interfaces bridge br0 member interface eth1 native-vlan '1'
set interfaces bridge br0 member interface eth2 allowed-vlan '100'
set interfaces bridge br0 member interface eth2 allowed-vlan '110'
set interfaces bridge br0 member interface eth2 allowed-vlan '120'
set interfaces bridge br0 vif 100 address '10.0.100.12/24'
set interfaces bridge br0 vif 110 address '10.0.110.12/24'
set interfaces bridge br0 vif 120 address '10.0.120.12/24'
set interfaces ethernet eth0 address '172.30.10.12/24'
set interfaces ethernet eth0 description 'MANAGE'
set interfaces ethernet eth0 vrf 'MANAGE'
set interfaces ethernet eth1 description 'to_vEOS-11'
set interfaces ethernet eth2 description 'to_client'
set protocols static route 0.0.0.0/0 next-hop 192.168.10.11
set service lldp

set service ntp server 172.30.10.254
set service ntp vrf 'MANAGE'
set service ssh vrf 'MANAGE'

set system domain-name 'home.my'
set system host-name 'VyOS-12'
set system ip disable-directed-broadcast
set system ip disable-forwarding

set system time-zone 'Asia/Tokyo'
set vrf name MANAGE ip disable-forwarding
set vrf name MANAGE table '100'
```

VyOS-12 との差分
```configuration:VyOS-13
% diff -u VyOS-12.txt VyOS-13.txt
--- VyOS-12.txt 2023-12-30 13:58:00.570278800 +0900
+++ VyOS-13.txt 2023-12-30 13:59:11.003313800 +0900
@@ -1,5 +1,5 @@
-vyos@VyOS-12:~$ show configuration commands
-set interfaces bridge br0 address '192.168.10.12/24'
+vyos@VyOS-13:~$ show configuration commands
+set interfaces bridge br0 address '192.168.10.13/24'
 set interfaces bridge br0 enable-vlan
 set interfaces bridge br0 member interface eth1 allowed-vlan '1'
 set interfaces bridge br0 member interface eth1 allowed-vlan '100'
@@ -9,10 +9,10 @@
 set interfaces bridge br0 member interface eth2 allowed-vlan '100'
 set interfaces bridge br0 member interface eth2 allowed-vlan '110'
 set interfaces bridge br0 member interface eth2 allowed-vlan '120'
-set interfaces bridge br0 vif 100 address '10.0.100.12/24'
-set interfaces bridge br0 vif 110 address '10.0.110.12/24'
-set interfaces bridge br0 vif 120 address '10.0.120.12/24'
-set interfaces ethernet eth0 address '172.30.10.12/24'
+set interfaces bridge br0 vif 100 address '10.0.100.13/24'
+set interfaces bridge br0 vif 110 address '10.0.110.13/24'
+set interfaces bridge br0 vif 120 address '10.0.120.13/24'
+set interfaces ethernet eth0 address '172.30.10.13/24'
 set interfaces ethernet eth0 description 'MANAGE'
 set interfaces ethernet eth0 vrf 'MANAGE'
 set interfaces ethernet eth1 description 'to_vEOS-11'
@@ -25,7 +25,7 @@
 set service ssh vrf 'MANAGE'

 set system domain-name 'home.my'
-set system host-name 'VyOS-12'
+set system host-name 'VyOS-13'
 set system ip disable-directed-broadcast
 set system ip disable-forwarding
```

VyOS の eth1 を落としてもルーティングしてしまいますねぇ。

## vEOS と VyOS のバージョン

```console:vEOS
vEOS-11#show version
Arista vEOS-lab
Hardware version:
Serial number: DEA61073AE7B13A4BA53B6B5CE12050C
Hardware MAC address: 000c.293b.4352
System MAC address: 000c.293b.4352

Software image version: 4.31.0F
Architecture: x86_64
Internal build version: 4.31.0F-33797590.4310F
Internal build ID: 99e563e1-3c0d-4bf7-95a4-4d314cc03ec6
Image format version: 1.0
Image optimization: None

Uptime: 12 hours and 17 minutes
Total memory: 8060768 kB
Free memory: 6349120 kB
```

```console:VyOS
vyos@VyOS-12:~$ show version
Version:          VyOS 1.5-rolling-202312290919
Release train:    current

Built by:         autobuild@vyos.net
Built on:         Fri 29 Dec 2023 10:49 UTC
Build UUID:       7d33802a-2e43-4044-8617-b18ac8918044
Build commit ID:  59e8817d2f4932

Architecture:     x86_64
Boot via:         installed image
System type:      VMware guest

Hardware vendor:  VMware, Inc.
Hardware model:   VMware Virtual Platform
Hardware S/N:     VMware-56 4d b9 6f 89 79 fd 70-b3 41 32 98 82 15 dd 18
Hardware UUID:    6fb94d56-7989-70fd-b341-32988215dd18

Copyright:        VyOS maintainers and contributors
```