Skip to content

Instantly share code, notes, and snippets.

@najtin
Last active April 3, 2023 13:55
Show Gist options
  • Save najtin/2244ffaaa6cb5333390e4674ed6aca59 to your computer and use it in GitHub Desktop.
Save najtin/2244ffaaa6cb5333390e4674ed6aca59 to your computer and use it in GitHub Desktop.
Fix WifiOnICE with Linux/ubuntu/docker

If WifiOnICE does not work on your Linux/Development Laptop, then it might be due to overlapping ip ranges. On my devices, the default docker network is 172.18.0.0/16 which is the same as the WifiOnICE network. You might experience that you can ping 172.18.0.1 but your browser does not auto detect the portal.

Now that we know why it does not work, the fix is straigt forward.

sudo systemctl stop docker

Edit or create /etc/docker/daemon.json Choose whatever range you like/is compatible with your setup.

{
  "default-address-pools":
    [
      {"base":"172.172.0.0/16","size":16}
    ]
}

Start docker

sudo systemctl start docker

Dangerzone:

You now need to delete the old default docker network. This will break existings containers with default network. First, identify the name of the problematic bridge.

ip addr

should result in somehthing like

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1350 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff permaddr XX:XX:XX:XX:XX:XX
4: br-64f2836e9c1e: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-64f2836e9c1e
       valid_lft forever preferred_lft forever
    inet6 fe80::42:3bff:fe69:4b7/64 scope link 
       valid_lft forever preferred_lft forever
17: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    inet 172.172.0.1/16 brd 172.172.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::XX:XXXX:XXXX:XXXX/64 scope link 
       valid_lft forever preferred_lft forever

In this case, we need to delete the network 64f2836e9c1e. In order to delete the network, we have to stop all containers using it.

sudo docker container stop XYZ

Then, we can delete the network.

sudo docker network rm 64f2836e9c1e

To repair the brocken container(those that used the deleted default network), either

  • convert the container into an image and recreate the container
  • delete the pod and recreate it from where ever it came from

Here we only cover the first option. (Based on https://stackoverflow.com/questions/65038509/i-need-to-remove-a-deleted-network-from-a-docker-container)

docker commit brocken_container repaired_container:latest
docker rm brocken_container
# in the next step you must include any ports you might want to open, or mounts eg
docker create repaired_container --name name_of_the_new_container -p 8080:8080
docker start name_of_the_new_container

For some reason i also had to update the /etc/resolv.conf in the repaired container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment