Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wifi connection dropped after docker start

I am logged in to my Lubuntu 16.04.2 LTS Server over Wifi and every time I start a docker container my connection gets dropped. Because I am relatively new to docker I can only guess that is has something to do with dockers virtual network creation. I should also mentioned that I disabled ipv6, but it makes no differences if enabled.

Here is my syslog, it shows what happens when I am running sudo docker run -it ubuntu bash. I can see the container/ubuntu prompt for 2-3 seconds before it freezes. Running it with --net=host works, but is not what I want.

ifconfig shows

docker0   Link encap:Ethernet  HWaddr 02:42:8d:8b:b7:4c  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:536 (536.0 B)  TX bytes:9678 (9.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:538 errors:0 dropped:0 overruns:0 frame:0
          TX packets:538 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:49592 (49.5 KB)  TX bytes:49592 (49.5 KB)

vethee1cf14 Link encap:Ethernet  HWaddr ba:53:4c:08:89:64  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:167 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:648 (648.0 B)  TX bytes:9888 (9.8 KB)

wlp2s0    Link encap:Ethernet  HWaddr f4:06:69:5d:ba:f6  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3082 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2916 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:556197 (556.1 KB)  TX bytes:569381 (569.3 KB)

docker network inspect bridge shows

[
    {
    "Name": "bridge",
    "Id": "8ec46d17f5cba798c8aba5c8457e019dcb24eade1285054f59c3430c33ff74f8",
    "Created": "2017-03-04T10:44:27.966018717+01:00",
    "Scope": "local",
    "Driver": "bridge",
    "EnableIPv6": false,
    "IPAM": {
        "Driver": "default",
        "Options": null,
        "Config": [
            {
                "Subnet": "172.17.0.0/16",
                "Gateway": "172.17.0.1"
            }
        ]
    },
    "Internal": false,
    "Attachable": false,
    "Containers": {},
    "Options": {
        "com.docker.network.bridge.default_bridge": "true",
        "com.docker.network.bridge.enable_icc": "true",
        "com.docker.network.bridge.enable_ip_masquerade": "true",
        "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
        "com.docker.network.bridge.name": "docker0",
        "com.docker.network.driver.mtu": "1500"
    },
    "Labels": {}
    }
]

With docker stopped ip a shows

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether f4:06:69:5d:ba:f6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.21/24 brd 192.168.178.255 scope global wlp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::f606:69ff:fe5d:baf6/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:6f:0c:38:7a brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global docker0
       valid_lft forever preferred_lft forever

What happens to my Wifi connection? Any help is appreciated. If more information would be helpful, please let me know.

UPDATE

Thx for you help. According to the responses I got so far, something seems to be wrong with my network configuration.

cat /etc/NetworkManager/NetworkManager.conf shows

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false

cat /etc/network/interfaces shows

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

Since I did no special configuration everything looks fine to me. Any suggestions where else I could look for information or how to work around the problem?

UPDATE

nmcli dev shows

DEVICE       TYPE      STATE        CONNECTION 
docker0      bridge    connected    docker0    
wlp2s0       wifi      unavailable  --         
vethf9342a9  ethernet  unmanaged    --         
lo           loopback  unmanaged    --  

while docker is running and

DEVICE   TYPE      STATE      CONNECTION 
docker0  bridge    connected  docker0    
wlp2s0   wifi      connected  meins      
lo       loopback  unmanaged  --  

when docker is stopped.

UPDATE

Added the following lines to /etc/NetworkManager/NetworkManager.conf to make NetworkManager ignore the docker interfaces.

[keyfile]
unmanaged-devices=interface-name:docker0;interface-name:veth*

Network manager ignored the interfaces, but the problem persists. So my guess is, that is a problem with my DHCP configuration.

UPDATE

There really seems to be a problem with the DHCP client. Disabling it helps. Any suggestions for a workaround?

like image 421
NaN Avatar asked Mar 01 '17 13:03

NaN


People also ask

Does Docker use DHCP?

By default, the container is assigned an IP address for every Docker network it connects to. The IP address is assigned from the pool assigned to the network, so the Docker daemon effectively acts as a DHCP server for each container.

What is the default network driver in Docker?

By default, Docker provides two network drivers for you, the bridge and the overlay drivers. You can also write a network driver plugin so that you can create your own drivers but that is an advanced task.

What is bridge mode Docker?

In terms of Docker, a bridge network uses a software bridge which allows containers connected to the same bridge network to communicate, while providing isolation from containers which are not connected to that bridge network.


1 Answers

Same problem on Ubuntu 18.04.

I think add the following content into file /etc/NetworkManager/NetworkManager.conf have sovled this problem:

[keyfile]
unmanaged-devices=interface-name:docker0;interface-name:veth*

You also need to do some other things:

  1. stop all your docker containers;
  2. restart network by sudo service network-manager restart, now your wifi should work well;
  3. start your docker containers again, my wifi is still working at this moment.

Mar 14, 2019

ref: https://askubuntu.com/a/1009402/620445

like image 91
Belter Avatar answered Sep 20 '22 12:09

Belter