Score:0

No wifi hotspot when docker is enabled

us flag

When I started the docker service/socket, I'm no more able to share my laptop connection via wifi hotspot. To be more precise, my phone still detects my hotspot, I enter the password, it tells me 'registered' but I also get a 'no internet connection'.

When I disable and stop the docker service and restart my laptop, the phone manages to connect to the internet.

I think that docker must be interfering with my network...

Do you have a solution to keep the docker service active, and at the same time allow me to share my internet connection as my wifi hotspot?

Thanks in advance


Linux Mint 21 Vanessa and Ubuntu 22.04 jammy
HP Zbook 15 power G8
Kernel 5.15.0-53-generic


iptables -n -v -L :

Chain INPUT (policy ACCEPT 2119 packets, 1236K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy DROP 51 packets, 3060 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   51  3060 DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
   51  3060 DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 1658 packets, 215K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain DOCKER (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
   51  3060 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  <WLANINTERFACE> *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      <WLANINTERFACE>  0.0.0.0/0            0.0.0.0/0           
   51  3060 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0  ```

Score:0
uy flag

@Donkeycode Docker modifies the iptables forwarding Queue. Ip Packets from you hotspot interface are dropped.

Diagnose:

iptables -n -v -L shows you current ruleset

iptables -Z resets the counter

try to use you hotspot. The first command will show you which rule drops your traffic.

Solution:

  1. Install the iptables-persistent packet
  2. Add the file /etc/iptables/rules.v4

This file needs the following context

*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:DOCKER - [0:0]
:DOCKER-USER - [0:0]
-A FORWARD -j DOCKER-USER
-A DOCKER-USER -i <WLANINTERFACE> -j ACCEPT
-A DOCKER-USER -o <WLANINTERFACE> -j ACCEPT
-A DOCKER-USER -j RETURN
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT

Please replace <WLANINTERFACE> with the name of your WLAN interface, something like wlan0 or wlp1s0.

Reboot and your hotspot will work

Donkeycode avatar
us flag
Hello @dummyuser, thank you for your answer. I followed all the instructions and I get the same result 'connected to the device, internet connection impossible'. I edited my question with the output I got when typing `iptables -n -v -L`
dummyuser avatar
uy flag
Hi @Donkeycode please replace <WLANINTERFACE> with the name of yout wlan interface (something like wlan0 or wlp1s0)
Donkeycode avatar
us flag
Thank you very much @dummyuser, it works now !
dummyuser avatar
uy flag
Hi @Donkeycode Perfect, feel free to confirm/vote for the answer.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.