You are not logged in.

#1 2015-04-19 17:01:50

maggie
Member
Registered: 2011-02-12
Posts: 255

Netctl network bridge for lxc breaks my host internet [solved]

I am following the shared inet page on the lxc wiki to get my container to have a network but when I start the bridge I made, my host machine loses its internet.

The hosts's netctl profile:

Description='A basic static ethernet connection using iproute'
Interface=eno1
Connection=ethernet
IP=static
Address='192.168.0.2/24'
Gateway='192.168.0.1'
DNS=('192.168.0.1')

The hosts's bridge profile:

Description="lxc bridge"
Interface=br0
Connection=bridge
BindsToInterfaces=(eno1)
IP=static
Address='192.168.0.3/24'
SkipForwardingDelay=yes

So I boot the host and the network is up just fine, but when I start the bridge with "netctl start lxcbridge" I can't ping anything from the host.

Last edited by maggie (2015-04-19 21:31:34)

Offline

#2 2015-04-19 18:26:13

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: Netctl network bridge for lxc breaks my host internet [solved]

You need to point the IP of the bridge to the host's and also include the gateway and dns.

Example from my system:

---BRIDGE---
Description="lxc bridge"
Interface=br0
Connection=bridge
BindsToInterfaces=(eno1)
IP=static
Address=10.1.10.200/24
Gateway=10.1.10.1
DNS=10.1.10.1
SkipForwardingDelay=yes

Note that you do not enable both the 'host' profile and the 'bridge' profile.  You only enable the 'bridge' profile.

The next step is your container config:

---/var/lib/lxc/playtime/config---
lxc.rootfs = /var/lib/lxc/playtime/rootfs
lxc.utsname = playtime
lxc.arch = x86_64
lxc.include = /usr/share/lxc/config/archlinux.common.conf

# network
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags=up
lxc.network.ipv4 = 10.1.10.202/24
lxc.network.ipv4.gateway=10.1.10.1
lxc.network.name = eth0

Don't forget to:

sudo sysctl net.ipv4.ip_forward=1 ; sudo sysctl net.ipv6.conf.default.forwarding=1 ; sudo sysctl net.ipv6.conf.all.forwarding=1
sudo iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE

Last edited by graysky (2015-04-19 18:48:53)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2015-04-19 18:45:49

maggie
Member
Registered: 2011-02-12
Posts: 255

Re: Netctl network bridge for lxc breaks my host internet [solved]

Thank you but it is still not working.

Offline

#4 2015-04-19 18:49:13

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: Netctl network bridge for lxc breaks my host internet [solved]

I edited my first post:

Note that you do not enable both the 'host' profile and the 'bridge' profile.  You only enable the 'bridge' profile.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2015-04-19 19:04:32

maggie
Member
Registered: 2011-02-12
Posts: 255

Re: Netctl network bridge for lxc breaks my host internet [solved]

The wiki did not say that. TY, it works now.

Offline

Board footer

Powered by FluxBB