Linux disable ipv6 centos

Как отключить IPv6 на примере OS CentOS 7

Временное отключение IPv6
Чтобы отключить IPv6 в процессе работы операционной системы без перезагрузки. используйте команду :
sysctl net.ipv6.conf.all.disable_ipv6=1
sysctl net.ipv6.conf.default.disable_ipv6=1

Если Вам нужно отключить IPV6 на конкретном интерфейсе, используйте уточненный параметр eth1:
sysctl net.ipv6.conf.eth1.disable_ipv6=1

Чтобы включить IPv6 в процессе работы операционной системы без перезагрузки. используйте команду :
sysctl net.ipv6.conf.all.disable_ipv6=0
sysctl net.ipv6.conf.default.disable_ipv6=0

Постоянное отключение IPv6
Чтобы IPv6 отключались при старте системы, нужно отредактировать файл /etc/sysctl.conf и добавить в него строки :
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Активировать изменения нужно командой
sysctl -p

Также Вы можете использовать раннее отключение IPv6 в модуле ядра.
Для этого необходимо отредактировать файл /etc/default/grub, и добавить параметр ipv6.disable=1:
# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=»console»
GRUB_CMDLINE_LINUX
GRUB_DISABLE_RECOVERY=»true»

После добавления параметра необходимо перегенерировать код загрузчика командой:
grub2-mkconfig -o /boot/grub2/grub.cfg

Затем необходимо перезагрузить систему, например, комндой shutdown -r или reboot.
После перезагрузки нужно ппроверить отключение IPv6 командой:
ip addr show | grep net6

Источник

RHEL 8 / CentOS 8 enable/disable IPv6

An Internet Protocol Version 6 (IPv6) address is an identifier of a network interface of a computer or a network node involved in an IPv6 computer network. This article will guide the user via simple steps on how to disable or re-enable IPv6 network addresses on RHEL 8 / CentOS 8. To temporarily enable/disable the IPv6 address on RHEL 8 / CentOS 8 we will use the sysctl command. Additionally, to permanently disable the IPv6 address we will modify the GRUB boot options.

In this tutorial you will learn:

  • How to temporarily disable the IPv6 address.
  • How to permanently disable IPv6 by modifying the GRUB boot options.

Enabled IPv6 on RHEL 8 Linux system.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to disable IPv6 on RHEL 8 / CentOS 8 step by step instructions

  1. To temporarily disable IPv6 address execute the following command from your terminal with administrative privileges:
# sysctl -w net.ipv6.conf.all.disable_ipv6=1

Disabled IPv6 network addresses on RHEL 8 Linux Server/Workstation

# grub2-editenv - list | grep kernelopts kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet

Next, append a new argument ipv6.disable=1 to the previously received kernelopts argument list: For example:

# grub2-editenv - set "kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet ipv6.disable=1"

Modify GRUB boot arguments do disable IPv6 on RHEL 8 Linux system

# sysctl -w net.ipv6.conf.all.disable_ipv6=0

Источник

Как отключить IPv6 в CentOS

По умолчанию, в CentOS протокол IPv6 включен. В некоторых случаях может потребоваться отключить его. Есть несколько способов сделать это. Самый простой это отключение на уровне ядра.

Отключение IPv6 в настройках ядра CentOS

Нужно добавить в файл /etc/sysctl.conf две строки

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

После этого либо перезапусть ОС – reboot либо динамически применить эти настройки

sysctl -p
systemctl restart network

Тоже самое можно сделать только для конкретного сетевого интерфеса.

Отключение IPv6 в настройках конкретного сетевого интерфейса CentOS

Для каждого такого сетевого интерфейса, нужно добавить в файл /etc/sysctl.conf строку

Здесь ens160 – это имя сетевого интерфеса. После этого либо перезапусть ОС – reboot либо динамически применить эти настройки

sysctl -p
systemctl restart network

Так же можно отключить IPv6 через загрузчик ОС – GRUB

Отключение IPv6 через настройки GRUB CentOS

Для этого способа, нужно внести в файл конфигурации GRUB — /etc/default/grub строку

GRUB_CMDLINE_LINUX=»ipv6.disable=1 crashkernel=auto rhgb quiet»

grub2-mkconfig -o /boot/grub2/grub.cfg

Есть более экзотические способы отключения IPv6 но на мой взгляд они устарели, хотя и работают при правильном конфигурировании.

Отключение IPv6 через настройку /etc/sysconfig/network

В файл /etc/sysconfig/network добавить параметры (если их нет)

В файл /etc/modprobe.d/modprobe.conf добавить следующие настройки (если файла нет, то его нужно создать)

options ipv6 disable=1
alias net-pf-10 off
alias ipv6 off
install ipv6 /bin/true

Источник

Способы отключения IPv6 в CentOS

Обновлено

Обновлено: 03.06.2020 Опубликовано: 06.07.2017

По умолчанию, IPv6 включено для CentOS, что может вызвать некоторые проблемы при обращении к локальной петле — запросы пойдут не на 127.0.0.1 а на ::1. В некоторых случаях, это критично, так как приложение может быть настроено на прослушку именно с 127.0.0.1.

Также проблема может возникнуть с менеджером пакетов yum, который будет пытаться подключиться к репозиториям по IPv6.

Глобальное отключение через ядро

Быстрый и правильный способ для глобального отключения ipv6.

И добавляем в него следующее:

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

Перезапускаем сетевую службу:

systemctl restart network

Отключение для определенного интерфейса

Если нам не нужно отключать IPv6 на уровне всей системы, а только, например, для ens32, также открываем настройку ядра:

systemctl restart network

Через GRUB

На самом деле, для большинства случаев будет достаточно вариантов, описанных выше. Для полной картины, опишем еще один способ.

Открываем на редактирование конфигурационный файл загрузчика:

Допишем следующую строчку:

GRUB_CMDLINE_LINUX=»ipv6.disable=1 crashkernel=auto rhgb quiet»

grub2-mkconfig -o /boot/grub2/grub.cfg

Для проверки, перезагрузим CentOS:

Опции IPV6INIT и IPV6_AUTOCONF

В некоторых инструкциях можно найти вариант отключения интерфейса с помощью такой настройки:

Однако, ни в CentOS 7, ни в других современных дистрибутивах Linux данные опции не дают ожидаемого результата.

На самом деле, опция работает, но для нее нужно сконфигурировать некоторые модули ядра (modprobe):

options ipv6 disable=1
alias net-pf-10 off
alias ipv6 off
install ipv6 /bin/true

Отключить IPv6 в файле network:

Данный метод трудоемкий и неудобный для использования, но решение оставим за администратором.

Отключение в yum

При желании отключить запросы по IPv6 только в менеджере пакетов yum, открываем файл:

Источник

How to Disable IPv6 in CentOS 8

An internet protocol version 6 (IPv6) is an identifier of a network interface that’s involved in an IPv6 computer network. If you don’t want to use Ipv6 addressing, you can opt to disable it either temporarily or permanently.

In this article, you are going to learn a few ways to disable IPv6 in your CentOS 8 Linux machine.

Disabling IPv6 in CentOS 8

First, check whether IPv6 is enabled on your CentOS 8 machine using the following ip command.

Check IPv6 Status in CentOS 8

If IPv6 enabled, you can see some inet6 lines, however, if the command doesn’t print anything, IPv6 is disabled on all your network interfaces.

Disable IPv6 Using sysctl Command

This method is for temporary disabling IPv6. You don’t require to reboot your system for the changes to take place. However, it’s quite complicated than the permanent method you will learn shortly.

First create a new sysctl configuration file /etc/sysctl.d/70-ipv6.conf using the following command.

Next, add the following lines and save the file.

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

Sysctl Configuration File

Now, to disable IPv6 use the following command.

# sysctl --load /etc/sysctl.d/70-ipv6.conf

Temporarily Disable IPv6 in CentOS 8

IPv6 should now be disabled.

To verify if IPv6 is disabled, run the following ip command.

Check IPv6 Disabled in CentOS 8

If the command doesn’t return anything implying that IPv6 has been disabled on all your network interfaces.

When using this method, some of your network interfaces may still use IPv6 once you reboot your system. This happens because CentOS 8 uses Network Manager by default.

To completely stop using IPv6, use the following nmcli command.

# nmcli connection modify interface ipv6.method ignore

Finally, reboot your CentOS 8 machine.

Disable IPv6 Using The Kernel Boot Option

The kernel boot option requires a system reboot after the configuration. It’s the best method of disabling IPv6.

To use this method, open the default GRUB configuration file /etc/default/grub with the vi text editor, as shown below.

Next, head to the end of the file and press O to create a new line and type the following.

GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX ipv6.disable=1"

Next, save and exit the configuration file.

The next step is to update the GRUB CFG files. Type the following command to locate the grub files.

You will see 2 GRUB CFG file paths: /boot/grub2/grub.cfg and /boot/efi/EFI/centos/grub.cfg.

Type the following command to create a new GRUB configuration file and save it to /boot/grub2/grub.cfg.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Next, type the following command to create a new GRUB configuration file and save it to /boot/efi/EFI/centos/grub.cfg.

# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Finally, reboot your CentOS 8 machine.

After rebooting, type the following command to verify whether IPv6 is disabled.

If the command does not print anything, it means IPv6 is disabled.

Summary

In this article, you have learned about two ways you can disable IPv6 on your CentOS 8 Linux machine. The first method is by using sysctl while the second is by using the Kernel boot option. While Disabling IPv6 Using sysctl is temporary, the Kernel boot option is permanent and is the best method.

Источник

Читайте также:  Gnu linux debian настройка
Оцените статью
Adblock
detector