LibVirt network configuration conflicts with Docker?
I’ve tried the typical GoogleFu and came up with a bunch of things, none of which helped...
I have a Debian server which was running Wheezy, dist-upgraded to Jessie, running a bunch of VMs through the KVM/QEMU approach. This sever has been running for 6+ years just fine.
Last weekend I put Docker on it to move services out of VMs and learn about containers. The Docker container I setup is working perfectly but I learned that my br0 interface isn’t passing external traffic.
- guest ping router, fails
- guest pings other guest, fails
- guest pings hosts, works
- host pings guest, works
- host pings router, works
The above is true for static assigned IPs but because one guest provides DHCP for others, any with DHCP can’t communicate on ipv4 at all due to lacking an IP.
Anyway... is this something any of you have seen? I’ve rebuilt the bridge and reconfigured VMs to no avail.
I then upgraded to Stretch thinking that Docker or a dependency may have assumed I was on the current stable. This didn’t help but it did show me that I had 2 gateways in my interface definition file so I fixed that. No errors or warnings on boot now... still no traffic.
Edit to add resolution:
iptables -A FORWARD -p tcp —tcp-flags SYN,RST SYN -j TCPMSS —clamp-mss-to-pmtu
Docker messes up my iptables. As soon as I put this rule back, bridged traffic started flowing.
Posted Jan 28, 2018, 5:27 PM UTC · edited
Just a quick thought but have you checked your FW? I'm quite sure both well rewrite the FW chains after loading.
By FW, you’re just referring to iptables? There’s no new secret stretchy firewall?
I was under the impression that bridged VM nics didn’t need any additional iptables rules... from my searching, it seemed to only be necessary for port forwarding to isolated virtual networks...
If I’m wrong, this is definitely the problem. It drew my focus because firewall problems explain exactly why the middle player could see everything but nothing got through.
I also checked the /proc forwarding rules and those were all bad after installing docker so I fixed them but it didn’t help.
Docker does screw around with iptables when you install it. It's a really big problem especially on systems that use
firewall-cmd, like RHEL7 and its derivatives.I ended up having to remove docker's rules from my system and manage firewall behavior myself. I found this page to be a helpful explanation of what was going on.
Mother of god! It was exactly as simple as I expected...
iptables -A FORWARD -p tcp —tcp-flags SYN,RST SYN -j TCPMSS —clamp-mss-to-pmtuAfter running that, it all works.
Now I just need to make sure Docker doesn’t break it on boot... which I think is going to happen.
Yay.
I'm glad you think iptables is simple... I'll go hide behind
firewall-cmdnow.So long as your iptables rules are persistent, I would suggest telling docker to stop molesting your chains via
/usr/bin/dockerd --iptables=falsein whatever autostart system Debian uses, rebooting the server, and then adding whatever iptables rules you need to add in order to restore docker container connectivity to the outside world—probably a MASQUERADE rule ondocker0.If you’re having to clamp TCP MSS it points at an MTU problem somewhere else on your network, or you have a shit ISP and you should be doing this on your edge router. Can also be cause by breaking Path MTU Discovery by inappropriate filtering of ICMP.