- IPv6 (Русский)
- Contents
- Обнаружение соседей
- Автоконфигурация узла (SLAAC)
- Клиент
- Privacy Extensions
- dhcpcd
- NetworkManager
- systemd-networkd
- connman
- Постоянный приватный адрес
- NetworkManager
- Статический адрес
- IPv6 и PPPoE
- Делегирование префикса (DHCPv6-PD)
- dhcpcd
- WIDE-DHCPv6
- systemd-networkd
- Другие клиенты
- Отключение IPv6
- Отключение функциональности
- Другие программы
- dhcpcd
- NetworkManager
- GnuPG
- systemd-timesyncd
- systemd-networkd
- Использование IPv4 вместо IPv6
- What is ipv6 in linux
- Contents
- Neighbor discovery
- Stateless autoconfiguration (SLAAC)
- For clients
- For gateways
- Privacy extensions
- dhcpcd
- NetworkManager
- systemd-networkd
- ConnMan
- Stable private addresses
- NetworkManager
- Static address
- IPv6 and PPPoE
- Prefix delegation (DHCPv6-PD)
- With dhcpcd
- With WIDE-DHCPv6
- systemd-networkd
- Other clients
- NAT64
- Disable IPv4
- Disable IPv6
- Disable functionality
- Other programs
- dhcpcd
- NetworkManager
- GnuPG
- systemd-timesyncd
- systemd-networkd
- Prefer IPv4 over IPv6
IPv6 (Русский)
В Arch Linux протокол IPv6 включён по умолчанию.
Статья Linux IPv6 HOWTO, хоть и давно не обновлялась, содержит подробную информацию об IPv6, от основ до более сложных тем. Если вы слабо знакомы с данным протоколом, то стоит сначала прочесть её.
Contents
Обнаружение соседей
Пинг по адресу многоадресной рассылки ff02::1 заставит все хосты в локальной сети ответить. При этом нужно указать сетевой интерфейс:
После этого список «соседей» по локальной сети можно вывести командой
Аналогично, если сделать пинг по адресу ff02::2 , то ответят только маршрутизаторы локальной сети.
Если добавить опцию -I ваш-глобальный-ipv6 в пинг-запрос, хосты локальной сети ответят с использованием глобальных адресов. В этом случае сетевой интерфейс можно не указывать:
Автоконфигурация узла (SLAAC)
Простейший способ получения IPv6-адреса в уже настроенной сети — автоконфигурация узла (SLAAC, Stateless address autoconfiguration). При этом адрес автоматически вычисляется на основании объявленного маршрутизатором префикса сети. Никакие дальнейшие настройки или использование специализированного ПО вроде DHCP-клиента не требуются.
Клиент
Если вы используете netctl, то нужно только добавить одну строку в файл настроек вашей проводной или беспроводной сети.
Если вы используете NetworkManager, то он автоматически включит использование IPv6-адресов, если таковые объявлены в сети.
Нужно также заметить, что для нормальной работы автоконфигурации должны быть разрешены пакеты ICMP для IPv6. Поэтому необходимо добавить разрешения для пакетов ipv6-icmp в настройки межсетевого экрана. Если вы используете брандмауэр на основе iptables, то добавьте следующее правило:
Если вы используете другой интерфейс межсетевого экрана (ufw, shorewall и т.д.), то инструкции по разрешению пакетов ipv6-icmp нужно искать в документации.
Если вы выбрали сетевой менеджер, который не поддерживает разрешение DNS с бесконтекстным (stateless) IPv6 (например, netctl), то для этох целей можно воспользоваться демоном rdnssd(8) из пакета ndisc6 .
Чтобы соответствующим образом работать с адресами IPv6 клиентских устройств вашей сети, нужно настроить демон объявлений (advertisement daemon). Для этой задачи используется входящий в официальные репозитории пакет radvd . Настройка radvd довольно проста. Добавьте следующие строки в файл /etc/radvd.conf , заменив LAN на название вашего сетевого интерфейса:
Такая настройка скажет клиентам выбрать адреса из объявленного блока /64 . Обратите внимание, что эта настройка объявляет все доступные префиксы, привязанные к сетевому интерфейсу. Если вы хотите указать конкретные префиксы, то замените ::/64 на необходимый, например, 2001:DB8::/64 . Блок настроек prefix нужно повторить для каждого указанного префикса.
Чтобы объявить DNS-сервера клиентам вашей локальной сети, можно использовать предлагаемую протоколом обнаружения соседей функциональность RDNSS. Например, добавьте следующие строки к файлу /etc/radvd.conf , чтобы объявить DNSv6-сервер Google:
Шлюз должен также разрешать трафик ipv6-icmp во всех основных цепочках межсетевого экрана. Для брэндмауэра/iptables добавьте правила:
Для других интерфейсов межсетевого экрана выполните аналогичные настройки и в конце не забудьте включить radvd.service .
Privacy Extensions
Когда устройство-клиент получает адрес посредством SLAAC, его IPv6-адрес вычисляется на основании префикса сети и MAC-адреса сетевого интерфейса. Это может иметь определённые последствия с точки зрения безопасности, поскольку MAC-адрес компьютера теперь можно узнать по IPv6-адресу. Для решения этой проблемы был разработан стандарт IPv6 Privacy Extensions (RFC 4941). В соответствии с ним ядро видоизменяет исходный адрес, генерируя вместо него временный. Такой подход используется, когда необходимо скрыть настоящий адрес при подключении к удалённому серверу.
Чтобы включить Privacy Extensions, добавьте в файл /etc/sysctl.d/40-ipv6.conf следующие строки:
Здесь nic0 . nicN — названия сетевых интерфейсов. В статье Настройка сети#Обнаружение сетевых интерфейсов описано, как узнать имена сетевых интерфейсов на вашей машине. Параметры all.use_tempaddr и default.use_tempaddr не будут применены к сетевым интерфейсам, которые уже определены в системе на момент выполнения файла настроек sysctl.
После перезагрузки Privacy Extensions будут включены.
dhcpcd
Стандартная конфигурация dhcpcd содержит опцию slaac private (RFC 7217), которая включает назначение стабильных приватных адресов вместо вычисления оных на основе аппаратных параметров. Дополнительная настройка не требуется, если, конечно, вы не хотите изменять адрес IPv6 чаще, чем в начале каждого нового подключения к сети. Если задать опцию slaac hwaddr , то будут назначаться постоянные адреса.
NetworkManager
NetworkManager использует IPv6 Privacy Extensions в соответствии с настройкой ipv6.ip6-privacy в файле NetworkManager.conf(5) или в профиле соединения. Если параметр не задан ни глобально, ни для соединения, NetworkManager будет использовать /proc/sys/net/ipv6/conf/default/use_tempaddr .
Чтобы включить IPv6 Privacy Extensions явно, добавьте следующие строки в файл NetworkManager.conf(5) :
Примените настройки и переподключитесь ко всем активным соединениям.
Чтобы включить IPv6 Privacy Extensions для отдельных соединений под управлением NetworkManager, отредактируйте соответствующий нужному соединения файл в каталоге /etc/NetworkManager/system-connections/ , добавив к разделу [ipv6] пару ключ-значение ip6-privacy=2 :
Перезагрузите соединение и подключитесь к нему снова.
systemd-networkd
Systemd-networkd тоже не учитывает настройки net.ipv6.conf.xxx.use_tempaddr в файле /etc/sysctl.d/40-ipv6.conf , если оцпия IPv6PrivacyExtensions в файле .network не установлена в значение kernel .
Тем не менее, учитываются некоторые другие опции:
connman
Добавьте следующую строку в файл службы (например, /var/lib/connman/название_службы/settings ):
Постоянный приватный адрес
Другой полезной возможностью являются описанные в RFC 7217 постоянные приватные IP-адреса (stable private addresses). Эта технология позволяет назначать интерфейсам постоянные адреса, для вычисления которых вместо MAC-адреса устройства используется специально сгенерированный ключ.
Чтобы заставить ядро сгенерировать ключ (например, для интерфейса wlan0 ), необходимо задать параметр ядра:
Выключив/включив интерфейс и выполнив ip addr show dev wlan0 вы увидите флаг stable-privacy рядом с каждым адресом IPv6. Ядро должно было создать 128-битный ключ для генерирования адресов этого интерфейса. Чтобы увидеть сам ключ, выполните команду sysctl net.ipv6.conf.wlan0.stable_secret . Чтобы ключ сохранялся после перезагрузок и был постоянным, нужно добавить в файл /etc/sysctl.d/40-ipv6.conf следующие строки:
NetworkManager
Описанные выше настройки не работают для NetworkManager, но он использует постоянные приватные адреса по умолчанию [1],[2].
Статический адрес
Иногда использование статического адреса может быть применено в качестве одной из мер обеспечения безопасности. Например, если ваш локальный маршрутизатор использует обнаружение соседей (Neighbor Discovery) или radvd (RFC 2461), вашему интерфейсу будет автоматически присвоен адрес, который содержит часть MAC-адреса сетевого интерфейса (используя SLAAC). Это может быть не слишком хорошо для безопасности, так как позволяет без труда отслеживать систему даже если часть IPv6-адреса сменилась.
Чтобы присвоить статический IP-адрес при помощи netctl, используйте шаблон профиля /etc/netctl/examples/ethernet-static . Следующие строки особенно важны:
IPv6 и PPPoE
Стандартный инструмент для PPPoE, pppd , позволяет использовать IPv6 в PPPoE, если это поддерживается вашим провайдером и модемом. Добавьте одну строку в файл /etc/ppp/options :
Если вы используете netctl для PPPoE, тогда вместо этого добавьте следующую строку в файл настроек netctl:
Делегирование префикса (DHCPv6-PD)
Делегирование префикса (prefix delegation) — широко распространённая технология развёртывания IPv6, используемая многими интернет-провайдерами. Представляет собой метод назначения сетевого префикса пользователю (например, локальной сети). Маршрутизатор может быть настроен на привязку разных сетевых префиксов к различным подсетям. Провайдер выдаёт префикс с помощью DHCPv6 (обычно это префикс /56 или /64 ), а dhcp-клиент назначает префикс локальной сети. В случае простого шлюза с двумя интерфейсами клиент обычно получает адрес через WAN-интерфейс (или псевдоинтерфейс вроде ppp) и на его основании присваивает IPv6-префикс интерфейсу, обращённому к локальной сети.
Клиент DHCPv6 принимает входящие соединения на UDP-порт 546. Чтобы настроить доступ к этому порту в межсетевом экране nftables, в файле /etc/nftables.conf добавьте следующее правило в цепочку input:
dhcpcd
dhcpcd помимо поддержки dhcp для IPv4 также предлагает полноценную реализацию протокола DHCPv6 (включая DHCPv6-PD). Если вы используете dhcpcd , отредактируйте файл /etc/dhcpcd.conf . Скорее всего, вы уже используете dhcpcd для IPv4, поэтому просто обновите существующую конфигурацию.
Эта конфигурация запросит префикс на WAN-интерфейсе ( WAN ) и делегирует его внутреннему интерфейсу ( LAN ). Если вдруг с диапазоном /64 возникнут проблемы, то нужно использовать вторую инструкцию ia_pd , которая в примере выше закомментирована. Кроме того, приведённая конфигурация также отключит вызовы маршрутизатора (router solicitation) для всех интерфейсов, кроме WAN.
WIDE-DHCPv6
WIDE-DHCPv6 — свободная реализация протокола DHCP для IPv6 (DHCPv6), первоначально разработанная проектом KAME. Установите его с пакетом wide-dhcpv6 AUR .
Если вы используете wide-dhcpv6 , отредактируйте файл /etc/wide-dhcpv6/dhcp6c.conf , заменив WAN и LAN названиями соответвующих интерфейсов:
Клиент wide-dhcpv6 можно запустить/включить с помощью файла юнита systemd dhcp6c@interface.service , где interface — название интерфейса в файле настроек, т.е. например для интерфейса «WAN» используйте dhcp6c@WAN.service .
systemd-networkd
Настройте внешний (wan) и внутренний (lan) интерфейсы. Это включит DHCPv6-PD для интерфейса с запущенным DHCPv6-клиентом. Делегированные префиксы предоставляются посредством IPv6 Router Advertisement во внутренней (локальной) сети.
Другие клиенты
dhclient также может запрашивать сетевой префикс, но для присваивания этого префикса или его части нужно использовать специальный скрипт. Пример программы: https://github.com/jaymzh/v6-gw-scripts/blob/master/dhclient-ipv6.
Отключение IPv6
Отключение функциональности
Параметр ядра ipv6.disable=1 отключает весь стек IPv6, что в большинстве случаев помогает добиться желаемого результата. О параметрах ядра см. Kernel parameters.
Другой параметр, ipv6.disable_ipv6=1 , оставит стек IPv6 работающим, но адреса IPv6 не будут присваиваться сетевым интерфейсам.
Также вы можете отключить присвоение адреса IPv6 конкретным сетевым интерфейсам, добавив следующие строки в файл настроек sysctl /etc/sysctl.d/40-ipv6.conf :
Перезапустите юнит systemd-sysctl.service , чтобы изменения вступили в силу.
Необходимо перечислить здесь все сетевые интерфейсы, для которых требуется отключение IPv6, так как опция all.disable_ipv6 не будет применена к сетевым интерфейсам, которые уже включены на момент выполнения инструкций из файла настроек.
Другие программы
Отключение IPv6 в ядре не предотвращает другие программы от попытки использования версии IPv6. В большинстве случаев это не приводит к проблемам, однако, если они все-таки появляются, вам остается лишь искать в man-страницах или на просторах сети способ отключить эту функциональность.
dhcpcd
Например, dhcpcd будет продолжать пытаться запрашивать настройки сети у маршрутизаторов IPv6 (т.н. Router solicitation). Чтобы отключить это, добавьте следующие строки в файл /etc/dhcpcd.conf :
NetworkManager
Чтобы отключить IPv6 в NetworkManager, вызовите контекстное меню значка статуса сети и перейдите в Edit Connections > Wired > Network name > Edit > IPv6 Settings > Method, затем выберите Method как Ignore/Disabled.
Чтобы определить, как systemd должен запускать службу ntpd, необходимо внести изменения в файл ntpd.service .
Это создаст drop-in сниппет, который будет запускаться вместо стандартного ntpd.service . Флаг -4 отключает использование IPv6 демоном ntp. Поместите следующее в drop-in сниппет:
Здесь сначала очищается значение ExecStart , а затем устанавливается новая команда.
GnuPG
Отключите IPv6 в настройка dirmngr:
После этого перезапустите пользовательскую службу dirmngr.service .
Добавьте следующие строки в файл sshd_config , чтобы убедиться, что sshd использует IPv4-адрес:
После этого перезапустите службу sshd.service .
systemd-timesyncd
Иногда systemd-timesyncd пытается отправлять запросы IPv6-серверу времени, даже если IPv6 отключён. Это может привести к тому, что системные часы не будут обновляться, а в журнале появятся сообщения об ошибках следующего вида:
Команда systemctl status systemd-timesyncd в пункте «Status» выведет IPv6-адрес целевого сервера:
Как видно из FS#59806, по протоколу IPv6 работают «2.»-сервера ntp.org. Чтобы запретить подключение к ним, удалите в файле /etc/systemd/timesyncd.conf записи 2.arch.pool.ntp.org и 2.pool.ntp.org из параметров NTP and FallbackNTP соответственно.
systemd-networkd
networkd позволяет отключить IPv6 для отдельного интерфейса. Когда в разделе [Network] сетевого юнита указан параметр LinkLocalAddressing=ipv4 или LinkLocalAddressing=no , networkd не будет настраивать IPv6 на соответствующих сетевых интерфейсах.
Следует однако отметить, что даже при использовании указанных выше опций networkd всё еще будет ожидать получения «объявлений маршрутизатора» (router advertisements, RA), если IPv6 не был отключён глобально для всей системы. Если трафик IPv6 не будет доходить до интерфейса (например, из-за настроек sysctl или ip6tables), то интерфейс останется в состоянии настройки и потенциально может стать причиной превышения времени ожидания (timeout) для служб, требующих полной настройки сети. Чтобы этого избежать, добавьте опцию IPv6AcceptRA=no в раздел [Network] .
Использование IPv4 вместо IPv6
The factual accuracy of this article or section is disputed.
Источник
What is ipv6 in linux
In Arch Linux, IPv6 is enabled by default.
The tldp Linux+IPv6-HOWTO article is older, and less maintained. Yet it attempts to cover many topics that are mentioned in this article, starts from the basics, and advances in a slower pace. It also has many command line examples. Beginners might want to read or skim it before reading this wiki article.
Contents
Neighbor discovery
Pinging the multicast address ff02::1 results in all hosts in link-local scope responding. An interface has to be specified:
After that, you can get a list of all the neighbors in the local network with:
With a ping to the multicast address ff02::2 only routers will respond.
If you add an option -I your-global-ipv6 , link-local hosts will respond with their link-global scope addresses. The interface can be omitted in this case:
Stateless autoconfiguration (SLAAC)
The easiest way to acquire an IPv6 address as long as your network is configured is through Stateless address autoconfiguration (SLAAC for short). The address is automatically inferred from the prefix that your router advertises and requires neither further configuration nor specialized software such as a DHCP client.
For clients
If you are using netctl you just need to add the following line to your Ethernet or wireless configuration.
If you are using NetworkManager then it automatically enables IPv6 addresses if there are advertisements for them in the network.
Please note that stateless autoconfiguration works on the condition that IPv6 icmp packets are allowed throughout the network. So for the client side the ipv6-icmp packets must be accepted. If you are using the Simple stateful firewall/iptables you only need to add:
If you are using an other firewall frontend (ufw, shorewall, etc) consult their documentation on how to enable the ipv6-icmp packets.
If your chosen network management solution does not support configuring the DNS resolver with stateless IPv6 (e.g. netctl), then it is possible to use rdnssd(8) from the ndisc6 package for that.
For gateways
To properly hand out IPv6s to the network clients we will need to use an advertising daemon. The standard tool for this job is radvd and is available in official repositories. Configuration of radvd is fairly simple. Edit /etc/radvd.conf to include
The above configuration will tell clients to autoconfigure themselves using addresses from the advertised /64 block. Please note that the above configuration advertises all available prefixes assigned to the LAN facing interface. If you want to limit the advertised prefixes instead of ::/64 use the desired prefix, e.g. 2001:DB8::/64 . The prefix block can be repeated many times for more prefixes.
To advertise DNS servers to your LAN clients you can use RDNSS feature. For example, add the following lines to /etc/radvd.conf to advertise Google’s DNS v6 servers:
The gateway must also allow the traffic of ipv6-icmp packets on all basic chains. For the Simple stateful firewall/iptables add:
Adjust accordingly for other firewall frontends and do not forget to enable radvd.service .
Privacy extensions
When a client acquires an address through SLAAC its IPv6 address is derived from the advertised prefix and the MAC address of the network interface of the client. This may raise security concerns as the MAC address of the computer can be easily derived by the IPv6 address. In order to tackle this problem the IPv6 Privacy Extensions standard (RFC 4941) has been developed. With privacy extensions the kernel generates a temporary address that is mangled from the original autoconfigured address. Private addresses are preferred when connecting to a remote server so the original address is hidden. To enable Privacy Extensions reproduce the following steps:
Add these lines to /etc/sysctl.d/40-ipv6.conf :
Where nic0 to nicN are your Network Interface Cards. You can find their names using the instructions in Network configuration#Listing network interfaces. The all.use_tempaddr or default.use_tempaddr parameters are not applied to nic’s that already exist when the sysctl settings are executed.
After a reboot, at the latest, Privacy Extensions should be enabled.
dhcpcd
dhcpcd’s default configuration includes the option slaac private , which enables «Stable Private IPv6 Addresses instead of hardware based ones», implementing RFC 7217. Therefore, it is not necessary to change anything, except if it is desired to change of IPv6 address more often than each time the system is connected to a new network. Set it to slaac hwaddr for a stable address.
NetworkManager
The use of IPv6 Privacy Extensions in NetworkManager can be controlled with the ipv6.ip6-privacy setting in NetworkManager.conf(5) or in the connection’s profile. If it is not set globally nor per-connection, NetworkManager will fall back to reading /proc/sys/net/ipv6/conf/default/use_tempaddr .
To explicitly enable IPv6 Privacy Extensions by default, add these lines to NetworkManager.conf(5) :
Apply the configuration and reconnect to all active connections.
To control the use of IPv6 Privacy Extensions for individual NetworkManager-managed connections, edit the desired connection keyfile in /etc/NetworkManager/system-connections/ and append to its [ipv6] section the key-value pair ip6-privacy=2 :
Reload the connection and reconnect to it afterwards.
systemd-networkd
systemd-networkd also does not honor the settings net.ipv6.conf.xxx.use_tempaddr placed in /etc/sysctl.d/40-ipv6.conf unless the option IPv6PrivacyExtensions is set with the value kernel in the .network file(s).
Other options for the IPv6 Privacy Extensions like:
are honored, however.
ConnMan
Set in a service file, i.e. /var/lib/connman/service/settings :
See ConnMan for details.
Stable private addresses
Another option is a stable private IP address (RFC 7217). This allows for IPs that are stable within a network without exposing the MAC address of the interface.
In order to have the kernel generate a key (for wlan0 , for example) we can set:
Bring the interface down and up and you should see stable-privacy next to each IPv6 address after running ip addr show dev wlan0 . The kernel has generated a 128-bit secret for generating ip addresses for this interface, to see it run sysctl net.ipv6.conf.wlan0.stable_secret . We are going to persist this value so add the following lines to /etc/sysctl.d/40-ipv6.conf :
NetworkManager
The above settings are not honored by NetworkManager, but NetworkManager uses stable private addresses by default.[1][2]
Static address
Sometimes, using a static address can improve security. For example, if your local router uses Neighbor Discovery or radvd (RFC 2461), your interface will automatically be assigned an address based on its MAC address (using IPv6’s Stateless Autoconfiguration). This may be less than ideal for security since it allows a system to be tracked even if the network portion of the IP address changes.
To assign a static IP address using netctl, look at the example profile in /etc/netctl/examples/ethernet-static . The following lines are important:
IPv6 and PPPoE
The standard tool for PPPoE, pppd(8) , provides support for IPv6 on PPPoE as long as your ISP and your modem support it. Just add the following to /etc/ppp/options
If you are using netctl for PPPoE then just add the following to your netctl configuration instead:
Prefix delegation (DHCPv6-PD)
Prefix delegation is a common IPv6 deployment technique used by many ISPs. It is a method of assigning a network prefix to a user site (i.e. local network). A router can be configured to assign different network prefixes to various subnetworks. The ISP hands out a network prefix using DHCPv6 (usually a /56 or /64 ) and a dhcp client assigns the prefixes to the local network. For a simple two interface gateway it practically assigns an IPv6 prefix to the interface connected to to the local network from an address acquired through the interface connected to WAN (or a pseudo-interface such as ppp).
DHCPv6 requires the client to receive incoming connections on port 546 UDP. For an nftables-based firewall, that can be configured with one line in the input chain in /etc/nftables.conf :
With dhcpcd
dhcpcd apart from IPv4 dhcp support also provides a fairly complete implementation of the DHCPv6 client standard which includes DHCPv6-PD. If you are using dhcpcd edit /etc/dhcpcd.conf . You might already be using dhcpcd for IPv4 so just update your existing configuration.
This configuration will ask for a prefix from WAN interface ( WAN ) and delegate it to the internal interface ( LAN ). In the event that a /64 range is issued, you will need to use the 2nd ia_pd instruction that is commented out instead. It will also disable router solicitations on all interfaces except for the WAN interface ( WAN ).
With WIDE-DHCPv6
WIDE-DHCPv6 is an open-source implementation of Dynamic Host Configuration Protocol for IPv6 (DHCPv6) originally developed by the KAME project. It can be installed with wide-dhcpv6 AUR .
If you are using wide-dhcpv6, edit /etc/wide-dhcpv6/dhcp6c.conf
The wide-dhcpv6 client can be started/enabled using the dhcp6c@interface.service systemd unit file, where interface is the interface name in the configuration file, e.g. for a interface name «WAN» use dhcp6c@WAN.service .
systemd-networkd
Configure both your upstream (wan) and downstream (lan) interface. This will enable DHCPv6-PD on the interface where the DHCPv6 client is running. The delegated prefixes are distributed by IPv6 Router Advertisement on the downstream network.
Other clients
dhclient can also request a prefix, but assigning that prefix, or parts of that prefix to interfaces must be done using a dhclient exit script. For example: https://github.com/jaymzh/v6-gw-scripts/blob/master/dhclient-ipv6.
NAT64
Wikipedia:NAT64 is the IPv6 transition mechanism where IPv6 only hosts are able to communicate with IPv4 hosts using NAT.
Linux kernel does not support NAT64 natively but there are several packages to add support for NAT64.
Disable IPv4
This article or section needs expansion.
Disable IPv6
This article or section needs expansion.
This article or section needs expansion.
Disable functionality
Adding ipv6.disable=1 to the kernel line disables the whole IPv6 stack, which is likely what you want if you are experiencing issues. See Kernel parameters for more information.
Alternatively, adding ipv6.disable_ipv6=1 instead will keep the IPv6 stack functional but will not assign IPv6 addresses to any of your network devices.
One can also avoid assigning IPv6 addresses to specific network interfaces by adding the following sysctl configuration to /etc/sysctl.d/40-ipv6.conf :
Restart the systemd-sysctl.service unit to apply the configuration changes.
Note that you must list all of the targeted interfaces explicitly, as disabling all.disable_ipv6 does not apply to interfaces that are already «up» when sysctl settings are applied.
Other programs
Disabling IPv6 functionality in the kernel does not prevent other programs from trying to use IPv6. In most cases, this is completely harmless, but if you find yourself having issues with that program, you should consult the program’s manual pages for a way to disable that functionality.
dhcpcd
dhcpcd will continue to harmlessly attempt to perform IPv6 router solicitation. To disable this, as stated in the dhcpcd.conf(5) man page, add the following to /etc/dhcpcd.conf :
NetworkManager
This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
To disable IPv6 in NetworkManager, right click the network status icon, and select Edit Connections > Wired > Network name > Edit > IPv6 Settings > Method > Ignore/Disabled. Then click Save.
Following advice in systemd#Drop-in files, edit ntpd.service to define how systemd starts it.
This will create a drop-in snippet that will be run instead of the default ntpd.service . The -4 flag prevents IPv6 from being used by the ntp daemon. Put the following into the drop-in snippet:
which first clears the previous ExecStart , and then replaces it with one that includes the -4 flag.
GnuPG
Disable IPv6 in the dirmngr‘s configuration file:
Restart the dirmngr.service user unit afterwards.
Ensure sshd is using IPv4 by adding the following to sshd_config :
And restart the sshd.service .
systemd-timesyncd
On occasion systemd-timesyncd will attempt to query an IPv6 timeserver even when IPv6 has been disabled. This can result in the system clock not being updated and the journal showing an error similar to:
The unit status of systemd-timesyncd will show an attempt to connect with an IPv6 address in its Status entry, similar to:
Per FS#59806, only the «2.» ntp.org pools serve IPv6. So to prevent this remove 2.arch.pool.ntp.org and 2.pool.ntp.org from the NTP and FallbackNTP entries in /etc/systemd/timesyncd.conf file.
systemd-networkd
networkd supports disabling IPv6 on a per-interface basis. When a network unit’s [Network] section has either LinkLocalAddressing=ipv4 or LinkLocalAddressing=no , networkd will not try to configure IPv6 on the matching interfaces.
Note however that even when using the above option, networkd will still be expecting to receive router advertisements if IPv6 is not disabled globally. If IPv6 traffic is not being received by the interface (e.g. due to sysctl or ip6tables settings), it will remain in the configuring state and potentially cause timeouts for services waiting for the network to be fully configured. To avoid this, the IPv6AcceptRA=no option should also be set in the [Network] section.
Prefer IPv4 over IPv6
The factual accuracy of this article or section is disputed.
Источник