LFS211 - Lab 16.1 Container without Internet access
Hello,
I'm looking for some help to get the LXC containers get internet access.
My physical host runs Fedora 32.
I run a CentOS 8 VM in qemu-kvm, which is where I've installed the lxc libs.
The VM has two virtio NICs:
- ens3 - default, i.e. NAT'd forwarding (192.168.122.0/24)
- ens10 - host-only, no forwarding (192.168.56.0/24) Although this shouldn't influence this exercise.
I've stopped firewalld.
The VM has no noticable issues. Internet access with DNS resolution work just fine. (Plus with virtio it's fast and it's the reason I kicked out virtual box).
Routes on the VM:
[root@training ~]# ip route show default via 192.168.122.1 dev ens3 proto dhcp metric 101 10.0.3.0/24 dev lxcbr0 proto kernel scope link src 10.0.3.1 192.168.56.0/24 dev ens10 proto kernel scope link src 192.168.56.127 metric 100 192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.32 metric 101
The lxcbr0
has been assigned an address
[root@training ~]# ip a s lxcbr0 4: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff inet 10.0.3.1/24 scope global lxcbr0 valid_lft forever preferred_lft forever inet6 fe80::216:3eff:fe00:0/64 scope link valid_lft forever preferred_lft forever
When I start one container (-n bucket), veth
link pairs are created. Here's the one on the VM side:
[root@training ~]# bridge link show lxcbr0 12: vethXZPS7P@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master lxcbr0 state forwarding priority 32 cost 2
In the container itself, it received an address via DHCP:
[root@bucket ~]# ip a s eth0 11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:16:3e:55:d8:5e brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.0.3.89/24 brd 10.0.3.255 scope global dynamic noprefixroute eth0 valid_lft 2410sec preferred_lft 2410sec inet6 fe80::216:3eff:fe55:d85e/64 scope link valid_lft forever preferred_lft forever
The container's route definition looks reasonable to me in that it all goes out to the bridge, lxcbr0
:
[root@bucket ~]# ip route show default via 10.0.3.1 dev eth0 proto dhcp metric 100 10.0.3.0/24 dev eth0 proto kernel scope link src 10.0.3.89 metric 100
I can ping VM interfaces ens3
, ens10
and lxcbr0
from the container no problem. However, I cannot, from my container, ping the bridges for the VM itself (i.e. the devices virbr0
and virbr1
that are defined on my physical host ) and I also can't ping external IPs like 8.8.8.8. DNS of course doesn't resolve either.
Both VM and physical hosts have net.ipv4.ip_forward = 1
.
Any ideas as to what could be amiss or additional things I could try to get more information?
Many thanks,
/Henrik
Comments
-
Hello Kenrik,
There are some fun things when dealing with QEMU/KVM and nested virtualization. That the container is getting a DHCP address is a good sign overall.
If it were me I'd start with tracepath to see where the packets are going.
Then wireshark/tcpdump on various interfaces to try to track where the packets are going.
Perhaps an nmap or nc from the host and another from the container, to see if there is something about ICMP messages that are not being forwarded.Some other things to check:
Can the bucket container ping itself?
If you deploy another container, can they ping each other?
Perhaps using a web server in the container you could test port 80 and again try to narrow down issues to ICMP/UDP/TCP?Others may have more exposure to this, but that's what I would look at first.
Regards,
1 -
Thanks @serewicz. I appreciate it. Things do get a bit trickier without internet access in the containers as I can't install dependencies in-place with yum/dnf. A good place to start following your steps is probably in the VM though and hopefully I'll see some signs of life on the bridge
lxcbr0
.Yes, the containers can talk to each other as well as the VM through said bridge. It's as if I needed a route on the VM from the bridge to the gateway. But if that was the case, the issue wouldn't be unique to my setup and more or less everyone would experience the same problem, which I suspect is not the case...
Anyway, thanks again for the input. I'll see what I can figure out from the suggestions you made.
Regards,
/Henrik0 -
I'm a big fan of OVS for these situations, makes in-memory networking much easier to handle: Open vSwitch with KVM how to
Then the containers and the host are all on the same switch and I can watch the traffic and/or view openflow rules to see what's happening to the traffic. But this may add more complexity to your configuration.
Regards,
0 -
I was hoping to do it with only linux-native tools but OVS might indeed be the thing I need to get it working and understanding why it currently is not. Thanks @serewicz
0
Categories
- All Categories
- 217 LFX Mentorship
- 217 LFX Mentorship: Linux Kernel
- 791 Linux Foundation IT Professional Programs
- 353 Cloud Engineer IT Professional Program
- 178 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 147 Cloud Native Developer IT Professional Program
- 137 Express Training Courses
- 137 Express Courses - Discussion Forum
- 6.2K Training Courses
- 47 LFC110 Class Forum - Discontinued
- 71 LFC131 Class Forum
- 42 LFD102 Class Forum
- 226 LFD103 Class Forum
- 18 LFD110 Class Forum
- 38 LFD121 Class Forum
- 18 LFD133 Class Forum
- 7 LFD134 Class Forum
- 18 LFD137 Class Forum
- 71 LFD201 Class Forum
- 4 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 697 LFD259 Class Forum
- 111 LFD272 Class Forum
- 4 LFD272-JP クラス フォーラム
- 12 LFD273 Class Forum
- 148 LFS101 Class Forum
- 1 LFS111 Class Forum
- 3 LFS112 Class Forum
- 2 LFS116 Class Forum
- 4 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 5 LFS144 Class Forum
- 4 LFS145 Class Forum
- 2 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 2 LFS157 Class Forum
- 29 LFS158 Class Forum
- 7 LFS162 Class Forum
- 2 LFS166 Class Forum
- 4 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 31 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム
- 18 LFS203 Class Forum
- 134 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 52 LFS241 Class Forum
- 48 LFS242 Class Forum
- 38 LFS243 Class Forum
- 15 LFS244 Class Forum
- 2 LFS245 Class Forum
- LFS246 Class Forum
- 48 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 152 LFS253 Class Forum
- 1 LFS254 Class Forum
- 1 LFS255 Class Forum
- 7 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 118 LFS260 Class Forum
- 159 LFS261 Class Forum
- 42 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 22 LFS268 Class Forum
- 30 LFS269 Class Forum
- LFS270 Class Forum
- 202 LFS272 Class Forum
- 2 LFS272-JP クラス フォーラム
- 1 LFS274 Class Forum
- 4 LFS281 Class Forum
- 9 LFW111 Class Forum
- 259 LFW211 Class Forum
- 181 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 795 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 102 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 758 Linux Distributions
- 82 Debian
- 67 Fedora
- 17 Linux Mint
- 13 Mageia
- 23 openSUSE
- 148 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 353 Ubuntu
- 468 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 93 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 63 Mobile Computing
- 18 Android
- 33 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 22 Study Material
- 805 Programming and Development
- 303 Kernel Development
- 484 Software Development
- 1.8K Software
- 261 Applications
- 183 Command Line
- 3 Compiling/Installing
- 987 Games
- 317 Installation
- 97 All In Program
- 97 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)