大网数据广告活动
服务器运维问答

Amazon EC2/VPC LXC Bridge not working

· 52CE 我爱测

On an AWS EC2 instance I like to host LXC containers as kind of virtual servers. I created a bridge (br0) containing only eth0 and gave it the private ip of my VPCs subnet. I reconfigured LXC not to use lxcbr0 as bridge, but my b…

问题原文

原帖链接 · devnull · CC BY-SA 3.0

On an AWS EC2 instance I like to host LXC containers as kind of virtual servers. I created a bridge (br0) containing only eth0 and gave it the private ip of my VPCs subnet. I reconfigured LXC not to use lxcbr0 as bridge, but my br0 device.

When I add a new container and assign it an IP address of my VPCs subnet, I can reach the container from the lxc host. I can also reach the lxc host from within the container. But every other address can not be reached although in the same subnet.

Bridge configuration:

auto br0
iface br0 inet static

bridge_ports eth0
bridge_fd 2
bridge_stp off

address 10.8.0.11
netmask 255.255.255.0
network 10.8.0.0
broadcast 10.8.0.255
gateway 10.8.0.1
dns-nameservers 8.8.8.8 8.8.4.4

VPC NIC was set to "Disable Source/Dest. check"

ip_forwarding is set to 1

no iptables rules existent

eth0 is set to promiscuous mode (ip link set eth0 promisc on)

lxc containers are being correctly associated with my bridge

In a hardware only environment, as well as on a VirtualBox environment this setup worked. However, on AWS it does not.

已采纳解答

原帖链接 · Nath · CC BY-SA 3.0

Bridging won't work, VPC doesn't isn't a layer 2 network and all ips need to be assign through the ec2 API. Your best bet is to use a totally separate (non-conflicting) subnet and have the host route traffic to the lxc containers Then update your VPC route tables with a static route to this subnet through your ec2 instances NIC. This is how openVPN works.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。