
LXC(컨테이너에는 실제 IP 주소가 필요함)에 대해 VLAN(ID 5)에 연결된 브리지(br0.5)를 생성하려고 합니다. 상자는 기본 VLAN에 연결되지 않으며 스위치의 포트는 트렁크로 구성됩니다.
그래서 /etc/network/interfaces에서 이 작업을 수행했습니다. 우분투 16.04 서버 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
네트워킹 하위 시스템이 해당 명령을 직접 처리합니다.