Site icon David Yin's Blog

How to Disable IPv6 on Ubuntu 22.04 terminal

I have the NAS. Transmission is running on it. I like setting port rules on my router to make the BT service visible from the public network. This post is about how to disable IPv6 on Ubuntu. You can also treat it as a guide to enable IPv6.

The problem is IPv6 is not working on it. So I just disabled IPv6 on Ubuntu Linux.

First I sign in to the server through putty.

Run command ip address

The 2001:270…. is the IPv6 address of this server.

Edit /etc/sysctl.conf file.

Add the following to the end of the file.

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

Then run the command to make it effective.

sudo sysctl -p

At the last, I check the IP address.

There is no more IPv6 ip address.

On the Transmission Web Control Panel, I test the port.

Done.

Reference of IPv6 on Ubuntu

There are different types of IPv6 addresses: Unicast, Anycast, and Multicast.

 

The full form is represented as 8 hexquad parcels of 16 bits each written in lower case hexadecimal, separated by colons (:). For example 2001:0db8:382b:23c1:aa49:4592:4efe:9982.

Often an address will have long substrings of all zeros; the longest and first run of all zero hexquads is abbreviated as a double colon (“::”). Since :: is variable length, it can only be used once per address. Leading “0”s are also omitted, up to three per hexquad. For example, fe80::1 is the canonical form of fe80:0000:0000:0000:0000:0000:0000:0001 and 2001:db8:b:23c1:49:4592:efe:9982 is the canonical form of 2001:0db8:000b:23c1:0049:4592:0efe:9982.

A third form is to write the last 32 bits in the well known dotted decimal IPv4 style. For example 2002::10.0.0.1 corresponds to the (hexadecimal) long representation 2002:0000:0000:0000:0000:0000:0a00:0001 with canonical form 2002::a00:1.

By now the reader should be able to understand the following:

# ip addr
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 86:75:6e:36:db:5a brd ff:ff:ff:ff:ff:ff
inet 192.168.100.188/24 brd 192.168.100.255 scope global dynamic ens18
valid_lft 4188sec preferred_lft 4188sec
inet6 2001:470:4aa0:0:8475:6eff:fe36:db5a/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86282sec preferred_lft 14282sec
inet6 fe80::8475:6eff:fe36:db5a/64 scope link
valid_lft forever preferred_lft forever

 

fe80::8475:6eff:fe36:db5a of interface ens18 is an autoconfigured link-local address. It is generated as an IEEE EUI-64 style identifier from the device’s hardware IEEE EUI-48(MAC) address as part of the autoconfiguration.

2001:470:4aa0:0:8475:6eff:fe36:db5a is the IPv6 address get from server.

vi IPv6 – Ubuntu Wiki

Exit mobile version