Ubuntu: VLAN + ブリッジが機能しない

Ubuntu: VLAN + ブリッジが機能しない

LXC 用の VLAN (ID 5) にリンクされたブリッジ (br0.5) を作成しようとしています (コンテナーには実際の IP アドレスが必要です)。ボックスはデフォルトの VLAN に接続せず、スイッチのポートはトランクとして構成されています。

そこで、/etc/network/interfaces でこれを実行しました。これは Ubuntu 16.04 Server LTS です。

auto enp1s0f0
iface enp1s0f0 inet manual
up /sbin/ifconfig enp1s0f0 up || /bin/true
down /sbin/ifconfig enp1s0f0 down || /bin/true

auto enp1s0f0.5
iface enp1s0f0.5 inet manual
vlan-raw-device eth0

auto br0
iface br0 inet manual
bridge_ports enp1s0f0 
bridge_stp off 
pre-up /sbin/ifconfig enp1s0f0 up || /bin/true
up /sbin/ifconfig br0 up || /bin/true 

auto br0.5
iface br0.5 net static
address 192.168.5.77
netmask 255.255.255.0
gateway 192.168.5.1
dns-nameservers 192.168.1.2 192.168.1.5 
vlan-raw-device br0

この設定を適用すると、デフォルト ルートが追加され、ゲートウェイは確かに 192.168.5.1 になります。問題は、何にも到達できず、同じ VLAN 内のホストに ping すらできないことです。すべてのインターフェイスは稼働しています。

何が欠けている?

答え1

やり方が少し間違っています。

実際の VLAN インターフェイスをブリッジに含める必要があるため、構成は次のようになります。

auto enp1s0f0
iface enp1s0f0 inet manual

auto enp1s0f0.5
iface enp1s0f0.5 inet manual

auto br0
iface br0 inet manual
bridge_ports enp1s0f0.5 
bridge_stp off 

auto br0
iface br0 net static
address 192.168.5.77
netmask 255.255.255.0
gateway 192.168.5.1
dns-nameservers 192.168.1.2 192.168.1.5

個別のコマンドも必要ありませんifconfig。ネットワーク サブシステムがそれらを直接処理します。

関連情報