2

I am trying to setup a Linux Container using bridged networking.

Here's how I setup my bridge: http://www.ericsbinaryworld.com/2016...he-connection/

Here's how I installed the container: http://www.ericsbinaryworld.com/2016...etting-up-lxc/

When I use lxc-attach -n lemmy to get into the container, I don't have internet access within the container.

Did I forget an easy step?

This is running in a KVM VM that is using macvtap and that the VM itself is able to access the net.

Other relevant info/things I've done to try and debug the problem.

Host OS: Fedora 24. VM: CentOS 7 - named Airship Inside of Airship, a container - named Lemmy.

First round of debugging: I started the VM - Airship. Logged into Airship as root.

ping www.google.com

works.

lxc-start -n lemmy -d
lxc-attach -n lemmy

Now I'm inside the container.

ping 8.8.8.8

gets me

connect: Network is unreachable

So I did an ip a and it looks like the interface isn't up. Did a check of systemctl status network.service and apparently it was in a failed state. When I tried a systemctl start network.service it just stays there without seeming to finish.

Second round of debugging: When I did a systemctl status network.service - it looks like it was stalling on trying to get a DHCP address. So I edited the following file:

/etc/sysconfig/network-scripts/ifcfg-eth0

To have:

DEVICE=eth0
ONBOOT=yes
IPADDR="192.168.1.36"
PREFIX="24"
GATEWAY="192.168.1.1"
DNS1="192.168.1.7"
DOMAIN="mushroomkingdom"
HOSTNAME=
NM_CONTROLLED=no
TYPE=Ethernet
MTU=

So now it comes up and has an IP address. But I can't reach anyone local or internet.

Dmesg shows:

[ 3932.778454] virbr0: port 2(vethFXTSQ3) entered forwarding state
[ 4089.412588] virbr0: received packet on eth0 with own address as source address

It can ping itself and the host.

[root@lemmy ~]# ping 192.168.1.36
PING 192.168.1.36 (192.168.1.36) 56(84) bytes of data.
64 bytes from 192.168.1.36: icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from 192.168.1.36: icmp_seq=2 ttl=64 time=0.034 ms
64 bytes from 192.168.1.36: icmp_seq=3 ttl=64 time=0.019 ms
64 bytes from 192.168.1.36: icmp_seq=4 ttl=64 time=0.031 ms

[root@lemmy ~]# ping 192.168.1.35
PING 192.168.1.35 (192.168.1.35) 56(84) bytes of data.
64 bytes from 192.168.1.35: icmp_seq=1 ttl=64 time=0.085 ms
64 bytes from 192.168.1.35: icmp_seq=2 ttl=64 time=0.047 ms

But if I try my local DNS:

[root@lemmy ~]# ping 192.168.1.7
PING 192.168.1.7 (192.168.1.7) 56(84) bytes of data.
From 192.168.1.36 icmp_seq=1 Destination Host Unreachable
From 192.168.1.36 icmp_seq=2 Destination Host Unreachable
From 192.168.1.36 icmp_seq=3 Destination Host Unreachable

Other things you might ask for:

[root@airship ~]# lxc-info -n lemmy
Name: lemmy
State: RUNNING
PID: 3802
IP: 192.168.1.36
CPU use: 0.18 seconds
BlkIO use: 92.50 KiB
Memory use: 1.11 MiB
KMem use: 0 bytes
Link: vethFXTSQ3
TX bytes: 3.24 KiB
RX bytes: 54.10 KiB
Total bytes: 57.34 KiB

and on the VM hosting the container:

[root@airship ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:3d:99:5c brd ff:ff:ff:ff:ff:ff
inet 192.168.254.214/24 brd 192.168.254.255 scope global dynamic ens4
   valid_lft 2308sec preferred_lft 2308sec
inet6 fe80::5054:ff:fe3d:995c/64 scope link 
   valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master virbr0 state UP qlen 1000
link/ether 52:54:00:64:f5:67 brd ff:ff:ff:ff:ff:ff
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 52:54:00:64:f5:67 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.35/24 brd 192.168.1.255 scope global virbr0
   valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe64:f567/64 scope link 
   valid_lft forever preferred_lft forever
8: vethFXTSQ3@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master virbr0 state UP qlen 1000
link/ether fe:6f:c5:df:0e:e1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::fc6f:c5ff:fedf:ee1/64 scope link 
   valid_lft forever preferred_lft forever

and:

[root@airship ~]# brctl show
bridge name bridge id           STP enabled interfaces
virbr0      8000.52540064f567      no         eth0 
                                             vethFXTSQ3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.