DEV Community

Yaroslav Polyakov
Yaroslav Polyakov

Posted on • Edited on

2 2

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

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay