wiki通りに設定できなかったので、自分で作成した時の方法を備忘録的な感じで残しておく。
※ここで想定するインターフェイス名は”eth0”, VLAN-IDは ”777”とする。
1.既存のインターフェイスのネットワーク設定にVLAN interface名を追加する。
interface名は”interface.VLAN-ID”となるようにする。
#emacs /etc/systemd/network/20-eth0.network |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[Match] Name=eth0 [Network] Address=10.1.1.36/24 DNS=8.8.8.8 Gateway=10.1.1.254 VLAN=eth0.777 # << VLAN interface名を追加 [Link] MTUBytes=1454 |
2.netdevファイルを作成し、使用するVLANのIDや、紐付けたいinterface名を指定する。
#emacs /etc/systemd/network/eth0.777.netdev |
1 2 3 4 5 6 |
[NetDev] Name=eth0.777 Kind=vlan [VLAN] Id=777 |
3.networkファイルを作成し、新規に作成したVLAN Interfaceに対するL3の情報を記述する。
#emacs /etc/systemd/network/20-eth0.777.network |
1 2 3 4 5 6 7 |
[Match] Name=eth0.777 [Network] Address=10.1.2.2/24 DNS=8.8.8.8 Gateway=10.1.2.254 |
4.systemd-networkdを念の為有効化し、再起動をする。
#systemctl enable systemd-networkd #reboot |
5.”ip a”コマンドで新規にVLAN interfaceが作成され、IPアドレスが付与されていればOK。