Closed Mohamedemad4 closed 3 years ago
Closing as it's almost certainly the usual issue with Docker on the host system firewalling off all traffic.
If you have Docker running alongside LXD, it messes with iptables and blocks all traffic from other container and VM managers (well, all IPv4 traffic that is). To fix that, remove Docker or reconfigure it to not mess with the entire system's firewalling.
If there's no Docker on the host system, please provide:
So i disabled the docker snap and rebooted the instance. But the issue still persists
The output of iptables -L -n -v
is:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:domain /* generated for LXD network lxdbr0 */
ACCEPT udp -- anywhere anywhere udp dpt:domain /* generated for LXD network lxdbr0 */
ACCEPT udp -- anywhere anywhere udp dpt:bootps /* generated for LXD network lxdbr0 */
ACCEPT tcp -- anywhere anywhere tcp dpt:openvpn
ACCEPT all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere /* generated for LXD network lxdbr0 */
ACCEPT all -- anywhere anywhere /* generated for LXD network lxdbr0 */
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp spt:domain /* generated for LXD network lxdbr0 */
ACCEPT udp -- anywhere anywhere udp spt:domain /* generated for LXD network lxdbr0 */
ACCEPT udp -- anywhere anywhere udp spt:bootps /* generated for LXD network lxdbr0 */
The output of ip6tables -L -n -v
is:
Chain INPUT (policy ACCEPT 2 packets, 184 bytes)
pkts bytes target prot opt in out source destination
8 808 lxd_nic_lxdbr0 all lxdbr0 * ::/0 ::/0 /* generated for LXD network lxdbr0 */
0 0 ACCEPT tcp lxdbr0 * ::/0 ::/0 tcp dpt:53 /* generated for LXD network lxdbr0 */
0 0 ACCEPT udp lxdbr0 * ::/0 ::/0 udp dpt:53 /* generated for LXD network lxdbr0 */
0 0 ACCEPT udp lxdbr0 * ::/0 ::/0 udp dpt:547 /* generated for LXD network lxdbr0 */
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 lxd_nic_lxdbr0 all lxdbr0 * ::/0 ::/0 /* generated for LXD network lxdbr0 */
0 0 ACCEPT all * lxdbr0 ::/0 ::/0 /* generated for LXD network lxdbr0 */
0 0 ACCEPT all lxdbr0 * ::/0 ::/0 /* generated for LXD network lxdbr0 */
Chain OUTPUT (policy ACCEPT 18 packets, 1832 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp * lxdbr0 ::/0 ::/0 tcp spt:53 /* generated for LXD network lxdbr0 */
0 0 ACCEPT udp * lxdbr0 ::/0 ::/0 udp spt:53 /* generated for LXD network lxdbr0 */
0 0 ACCEPT udp * lxdbr0 ::/0 ::/0 udp spt:547 /* generated for LXD network lxdbr0 */
Chain lxd_nic_lxdbr0 (2 references)
pkts bytes target prot opt in out source destination
0 0 DROP icmpv6 lxdbr0 * ::/0 ::/0 PHYSDEV match --physdev-in vethf6d4fc60 ipv6-icmptype 136 STRING match ! "|00163eca9bf6|" ALGO name bm FROM 66 TO 72 /* generated for LXD container container-a8c0-es25-jpck (eth0) */
0 0 DROP icmpv6 lxdbr0 * ::/0 ::/0 PHYSDEV match --physdev-in vethf6d4fc60 ipv6-icmptype 136 STRING match ! "|fd42c50ed848412c02163efffeca9bf6|" ALGO name bm FROM 48 TO 64 /* generated for LXD container container-a8c0-es25-jpck (eth0) */
Also worth mentioning that i had to manually load the br_netfilter
kernel module before i could start any of the containers.
because i was getting this error:
Error: Failed preparing container for start: Failed to start device "eth0": security.ipv6_filtering requires br_netfilter be loaded: open /proc/sys/net/bridge/bridge-nf-call-ip6tables: no such file or directory
Which makes me assume that docker probably was loading it for me before. @stgraber
Can you show ebtables -Lv
too?
@tomponline any ideas? Firewall looks reasonable now.
-> ebtables -Lv
Bridge table: filter
Bridge chain: INPUT, entries: 0, policy: ACCEPT
Bridge chain: FORWARD, entries: 0, policy: ACCEPT
Bridge chain: OUTPUT, entries: 0, policy: ACCEPT
@stgraber
@Mohamedemad4 please show output of ip a
and ip r
on both the host and the container.
Also please provide output of ps aux | grep dnsmasq
and sudo ss- ulpn
on the host.
-> ps aux | grep dnsmasq
lxd 2414 0.0 0.0 8928 3912 ? Ss Oct06 0:00 dnsmasq --keep-in-foreground --strict-order --bind-interfaces --except-interface=lo --pid-file= --no-ping --interface=lxdbr0 --dhcp-rapid-commit --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=10.222.79.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases --dhcp-hostsfile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.hosts --dhcp-range 10.222.79.2,10.222.79.254,1h --listen-address=fd42:c50e:d848:412c::1 --enable-ra --dhcp-range ::,constructor:lxdbr0,ra-stateless,ra-names -s lxd --interface-name _gateway.lxd,lxdbr0 -S /lxd/ --conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.raw -u lxd -g lxd
root 250820 0.0 0.0 6404 736 pts/0 S+ 11:55 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox dnsmasq
-> ss -ulpn
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 0.0.0.0:42400 0.0.0.0:* users:(("rsyslogd",pid=1058,fd=7))
UNCONN 0 0 10.222.79.1:53 0.0.0.0:* users:(("dnsmasq",pid=2414,fd=8))
UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=972,fd=12))
UNCONN 0 0 0.0.0.0%lxdbr0:67 0.0.0.0:* users:(("dnsmasq",pid=2414,fd=4))
UNCONN 0 0 10.172.0.6%ens4:68 0.0.0.0:* users:(("systemd-network",pid=969,fd=19))
UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("chronyd",pid=1037,fd=5))
UNCONN 0 0 [fd42:c50e:d848:412c::1]:53 [::]:* users:(("dnsmasq",pid=2414,fd=10))
UNCONN 0 0 [::1]:323 [::]:* users:(("chronyd",pid=1037,fd=6))
UNCONN 0 0 [::]%lxdbr0:547 [::]:* users:(("dnsmasq",pid=2414,fd=6))
-> ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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 1460 qdisc mq state UP group default qlen 1000
link/ether 42:01:0a:ac:00:06 brd ff:ff:ff:ff:ff:ff
inet 10.172.0.6/32 scope global dynamic ens4
valid_lft 2962sec preferred_lft 2962sec
inet6 fe80::4001:aff:feac:6/64 scope link
valid_lft forever preferred_lft forever
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
link/none
inet 10.8.0.1/24 brd 10.8.0.255 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::9f4:8d7f:ba5f:540c/64 scope link stable-privacy
valid_lft forever preferred_lft forever
5: lxdbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 00:16:3e:26:44:53 brd ff:ff:ff:ff:ff:ff
inet 10.222.79.1/24 scope global lxdbr0
valid_lft forever preferred_lft forever
inet6 fd42:c50e:d848:412c::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe26:4453/64 scope link
valid_lft forever preferred_lft forever
-> ip r
default via 10.172.0.1 dev ens4 proto dhcp src 10.172.0.6 metric 100
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
10.172.0.1 dev ens4 proto dhcp scope link src 10.172.0.6 metric 100
10.222.79.0/24 dev lxdbr0 proto kernel scope link src 10.222.79.1 linkdown
-> ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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
16: eth0@if17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:ca:9b:f6 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fd42:c50e:d848:412c:216:3eff:feca:9bf6/64 scope global dynamic mngtmpaddr
valid_lft 3599sec preferred_lft 3599sec
inet6 fe80::216:3eff:feca:9bf6/64 scope link
valid_lft forever preferred_lft forever
-> ip r
[no output]
@tomponline
Please can you show sudo nft list ruleset
.
Also can you confirm that running lxc exec <container> -- dhclient
doesn't result in an IPv4 address being allocated?
Small update: One of the containers got an ipv4 address automatically (still measuring how long, but measure in minutes not milliseconds )
Here is the ip r
output from it
default via 10.222.79.1 dev eth0 proto dhcp src 10.222.79.10 metric 100
10.222.79.0/24 dev eth0 proto kernel scope link src 10.222.79.10
10.222.79.1 dev eth0 proto dhcp scope link src 10.222.79.10 metric 100
The output of nft list ruleset
(btw i had to install nftables
first.)
table inet filter {
chain input {
type filter hook input priority filter; policy accept;
}
chain forward {
type filter hook forward priority filter; policy accept;
}
chain output {
type filter hook output priority filter; policy accept;
}
}
lxc exec <container> -- dhclient
lxc exec <container> -- dhclient
actually results in an ipv4 being allocated but i noticed the whole exec
flow is sluggish
According to lxc monitor
it hangs at Started mirroring websocket
for approx 2 minutes before the flow continues and the command is executed.
This is true for all commands running on this instance (even after the container gets an ipv4)
@tomponline
OK so there is something wrong inside your container, its not requesting a DHCP allocation.
I would double check what is running inside the container and ensure the network configure is correct, also check journalctl inside the container for any errors.
So upon checking the logs I have discovered the issue to be that the main ZFS pool was out of space.😅 Closing.
Issue description
The lxd instance has been working normally for the past 3 months or so. but today it not allocating ipv4 addresses to containers when they start (ipv6 works fine!!) I have verified that
dnsmasq
is working on the host. And i am out of ways to debug this issue.Steps to reproduce
Here are some more outputs that might be relevant to the issue
Required information
the output of
lxc network info lxdbr0
this message in the dmesg log relating to lxdbr0
the main lxd deamon log
same container log of one of the affected containers
expanded config of one of the affected containers