- How to disable ipv6 in Linux Mint
- Как отключить Ipv6 в Ubuntu, Linux Mint, Debian.
- Как отключить IP версии 6 в Linux
- Отключение через ядро Linux
- Глобально (для всех интерфейсов)
- Для определенного интерфейса
- How to disable Ipv6 on Ubuntu, Linux Mint, Debian
- Check if your system supports ipv6 ?
- Problems if ipv6 not supported
- Method 1 — Disable Ipv6 from sysctl
- Method 2 : Disable ipv6 from GRUB
- 14 Comments
How to disable ipv6 in Linux Mint
Linux Mint is Ubuntu-based which in turn is based on Debian, and I’ve seen two basic ways to do this in Debian:
First method: Blacklist the ipv6 module by adding the following to /etc/modprobe.d/blacklist (on newer systems it’s /etc/modprobe.d/blacklist.conf):
Second method: Turn off the aliases in /etc/modprobe.d/aliases. Create a new file in the /etc/modprobe.d directory, call it 00local . (This will prevent your change from being removed by an upgrade to a default alias file.) Add these lines to that file:
alias net-pf-10 off alias ipv6 off
However, all of this is for disabling or turning off a module-based ipv6, and at least one post I saw suggested that very recent kernels (circa 2.6.29) have ipv6 support built in. So at some point, neither of these two methods will work. (Please note that you will need superuser privileges for either of these methods. I’ve also seen at least one post that mentioned a further required step for KDE users. I’ll post links below.)
After this, there are two optional steps. First you can turn off ipv6 in your browser. I only know how to do this in Firefox, but I’m sure it can be done in other browsers. Second, you can comment out all lines in /etc/hosts that refer to ipv6. It’s not clear to me that these two tweaks give any huge benefit, but I’ll mention how to do each. For Firefox, you can disable ipv6 support by opening a window and entering ‘about:config’ in the address bar. Then search for ipv6 and set the network.dns.disableIPv6 option to true by double clicking on it. (It’s a boolean and set to false by default, so you can switch its state easily.) For /etc/hosts, open that file in your favorite editor (you’ll need superuser privileges to edit it), and put a # at the start of all the lines that refer to ipv6.
Links (some of these links offer methods that are slight variants on the two I give above; I stuck them in for added ideas):
Как отключить Ipv6 в Ubuntu, Linux Mint, Debian.
Наличие активной настройки Ipv6 в Linux мы можем проверить командой:
в выводе которой увидим что-то вроде:
eth2 Link encap:Ethernet HWaddr 00:00:00:00:79:00 inet addr:192.168.0.29 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::21c:c0ff:fe80::21c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1108 errors:0 dropped:0 overruns:0 frame:0 TX packets:1119 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:622395 (6.8 MB) TX bytes:25148 (2.5 MB) Interrupt:30 Memory:e37320-e33522
строчка «inet6 addr: fe80::21c:c0ff:fe80::21c/64 Scope:Link» говорит о том, что сетевое подключение может быть организовано по ipv6.
Отключается ipv6 в Ubuntu, Linux Mint, Debian очень легко.
1. Открываем файл:
В конец файла добавим строки:
# IPv6 disabled net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
Сохраните файл CTRL+X — Y (ДА) — Enter.
Применяем изменения командой:
$ sudo sysctl -p $sudo /etc/init.d/networking restart
Убедимся , что у нас пропала срока «inet6 addr: fe80::21c:c0ff:fe80::21c/64 Scope:Link»
через команду:
$ ifconfig eth2 Link encap:Ethernet HWaddr 00:00:00:00:79:00 inet addr:192.168.0.29 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1108 errors:0 dropped:0 overruns:0 frame:0 TX packets:1119 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:622395 (6.8 MB) TX bytes:25148 (2.5 MB) Interrupt:30 Memory:e37320-e33522
Как отключить IP версии 6 в Linux
Обновлено: 16.05.2020 Опубликовано: 23.03.2019
IPv6 далеко не всегда может использоваться в системе. Более того, он может вызвать некоторые проблемы при обращении к локальной петле (127.0.0.1) — запросы могут пойти на адрес ::1, что может привести к тому, что некоторые приложения будут работать не корректно.
В данной инструкции используются универсальные методы, которые подойдут для различных систем, например, Ubuntu, CentOS, Debian, Red Hat и так далее.
Отключение через ядро Linux
Быстрее всего отключить IPv6 через настройку ядра. Это универсальный способ и он подойдет для многих дистрибутивов на базе Linux.
Глобально (для всех интерфейсов)
Создаем или открываем файл:
* 99-sysctl.conf является основным конфигурационным файлом, а 10-ipv6-privacy.conf в каталоге sysctl.d — дополнительным. Для удобства лучше использовать последний.
Добавляем следующие строки:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Если вносили изменения в файл /etc/sysctl.d/99-sysctl.conf:
Если вносили изменения в файл /etc/sysctl.d/10-ipv6-privacy.conf:
sysctl -p /etc/sysctl.d/10-ipv6-privacy.conf
Проверяем — должны остаться только адреса IPv4:
Для определенного интерфейса
Если нужно отключить IPv6 только для одного интерфейса, например, для eth0, также открываем настройку ядра.
How to disable Ipv6 on Ubuntu, Linux Mint, Debian
Ipv6 is the next version of the addressing scheme Ipv4 that is currently being used to assign numerical address to domain names like google.com over the internet.
Ipv6 allows for more addresses than what Ipv4 supports. However it is not yet widely supported and its adoption is still in progress.
Check if your system supports ipv6 ?
Check out http://testmyipv6.com/ to see if you network supports Ipv6.
For Ipv6 to work you need —
1. An OS that supports IPv6. Ubuntu and most modern Linuxes do that.
2. Your network hardware (router/modem) must support Ipv6. Many of the good brands do.
3. Your ISP must also support IPv6. This is something that is not present everywhere !
Check the output of ifconfig command to see the «inet6 addr» line.
$ ifconfig eth0 Link encap:Ethernet HWaddr 00:1c:c0:f8:79:ee inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::21c:c0ff:fef8:79ee/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 .
Problems if ipv6 not supported
So if ipv6 is not supported on your network infrastructure, it might be useful to disable it all together. It can cause issues like delayed domain lookups, un-necessary attempts to connect to ipv6 addresses causing delay in network connection etc.
I did come across some problems like that. The apt-get command occasionally tries to connect to ipv6 addresses and fails and then retries an ipv4 address. Take a look at this output
$ sudo apt-get update Ign http://archive.canonical.com trusty InRelease Ign http://archive.canonical.com raring InRelease Err http://archive.canonical.com trusty Release.gpg Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80] Err http://archive.canonical.com raring Release.gpg Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80] .
Errors like those have been more frequent in the recent Ubuntu versions, probably because they try to use Ipv6 more than before.
I noticed similar issues happen in other applications like Hexchat and also Google Chrome which would sometimes take longer than usual to lookup a domain name.
So the best solution is to disable Ipv6 entirely to get rid of those things. It takes only a small configuration and can help you solve many network issues on your system. Users have even reported an increase in internet speed.
Method 1 — Disable Ipv6 from sysctl
The first method to disable Ipv6 is to edit kernel level parameters via sysctl interface.
The kernel parameters that enable ipv6 are as follows
$ sysctl net.ipv6.conf.all.disable_ipv6 net.ipv6.conf.all.disable_ipv6 = 0 $ sysctl net.ipv6.conf.default.disable_ipv6 net.ipv6.conf.default.disable_ipv6 = 0 $ sysctl net.ipv6.conf.lo.disable_ipv6 net.ipv6.conf.lo.disable_ipv6 = 0
Note that the variables control «disabling» of ipv6. So setting them to 1 would disable ipv6
Edit the file — /etc/sysctl.conf
And fill in the following lines at the end of that file
# IPv6 disabled net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
Save the file and close it. Restart sysctl with
Check the output of ifconfig again and there should be no ipv6 address
$ ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:5f:28:8b inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1346 errors:0 dropped:0 overruns:0 frame:0 TX packets:965 errors:0 dropped:0 overruns:0 carrier:0 .
If it does not work, then try rebooting the system and check ifconfig again.
Method 2 : Disable ipv6 from GRUB
Ipv6 can also be disabled by editing the grub configuration file
$ sudo gedit /etc/default/grub
Look for the line containing «GRUB_CMDLINE_LINUX» and edit it as follows
GRUB_CMDLINE_LINUX="ipv6.disable=1"
The same can also be added to the value of the variable named «GRUB_CMDLINE_LINUX_DEFAULT» and either would work. Save the file, close it and regenerate the grub configuration
Reboot. Now ipv6 should be disabled.
A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .
14 Comments
- TFE March 2, 2017 at 5:05 pm I think you’re using Lilo not Grub. or something else. Please refer to this
http://askubuntu.com/questions/107440/how-to-check-what-bootloader-my-system-is-using
to check your system bootloader