DEV Community

Yaroslav Polyakov
Yaroslav Polyakov

Posted on • Updated on

Create-react-app and apt freezes + script to enable/disable IPv6

Sometimes npx create-react-app just freezes and does not work at all:

$ npx create-react-app myapp
^C
Enter fullscreen mode Exit fullscreen mode

Same problem I had with APT on my debian virtual machine inside LXC/LXD container - it just freezes and not working.

In my case, this is because I use Wireguard VPN and tunnel IPv4, but not IPv6. Yes, right way would be to forward IPv6 over VPN too, but I'm too lazy.

one-line fix:

sudo sysctl net.ipv6.conf.all.disable_ipv6=1
Enter fullscreen mode Exit fullscreen mode

Optionally, you may put this to /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Enter fullscreen mode Exit fullscreen mode

But if you need to toggle IPv6 on/off often, here is simple script, put it to /usr/local/bin/ipv6:

#!/bin/bash

case $1 in
    yes | on)
        echo enable IPv6
        sudo sysctl net.ipv6.conf.all.disable_ipv6=0
        ;;
    no | off)
        echo disable IPv6
        sudo sysctl net.ipv6.conf.all.disable_ipv6=1
        ;;
    *)
        echo on/off?
        if [ `/usr/sbin/sysctl net.ipv6.conf.all.disable_ipv6   | cut -f 2 -d= | tr -d " "` == "0" ]
        then
            echo IPv6 is enabled now
        else
            echo IPv6 is disabled now
        fi
        ;;
esac

Enter fullscreen mode Exit fullscreen mode

chmod +x it and....

$ ipv6 on
enable IPv6
net.ipv6.conf.all.disable_ipv6 = 0

$ ipv6 off
disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
Enter fullscreen mode Exit fullscreen mode

Top comments (0)