S
S
stanlee2014-11-10 13:22:44
Computer networks
stanlee, 2014-11-10 13:22:44

How to set up networking for lxc on CentOS 7?

Help setting up mesh for lxc containers in CentOS 7.
installed bridge-utils
added interface
DEVICE=virbr0
TYPE=Bridge
BOOTPROTO=none
IPADDR=10.10.0.1
NETMASK=255.255.255.0
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
restarted mesh
bridge visible in the list , but containers don't see the world (

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2014-11-10
@melkij

IPADDR=10.10.0.1

So /proc/sys/net/ipv4/ip_forward and masquerading are enabled on the host machine?

J
John_Alban, 2015-10-23
@John_Alban

If you need to set up a bridged network (without NAT), then you can do this (however, I write for debian-based).
in the container settings (located in /var/lib/lxc/$NAME/) write:
lxc.network.flags = up
lxc.network.link = virbr0
lxc.network.veth.pair = veth0
lxc.network.ipv4 = 10.10. 0.2/24
lxc.network.ipv4.gateway = 10.10.0.1
add to bridge settings:
bridge_fd 0
bridge_maxage 0
add route:
route add -host 10.10.0.2 dev virbr0
forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
check whether filtering is enabled in /proc/sys/net/bridge/bridge-nf*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question