How to check if IPv6 is enabled in Linux

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to check if IPv6 is enabled and configured on your Linux system. You will explore different methods to verify IPv6 status and settings.

Specifically, you will use the ip addr command to inspect configured IPv6 addresses, examine the /proc/sys/net/ipv6 directory to check the kernel's IPv6 status, and utilize the sysctl command to view detailed IPv6 network parameters. These steps will provide a comprehensive understanding of your system's IPv6 configuration.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("Linux")) -.-> linux/RemoteAccessandNetworkingGroup(["Remote Access and Networking"]) linux(("Linux")) -.-> linux/BasicFileOperationsGroup(["Basic File Operations"]) linux/BasicFileOperationsGroup -.-> linux/ls("Content Listing") linux/BasicFileOperationsGroup -.-> linux/cat("File Concatenating") linux/RemoteAccessandNetworkingGroup -.-> linux/ifconfig("Network Configuring") linux/RemoteAccessandNetworkingGroup -.-> linux/netstat("Network Monitoring") linux/RemoteAccessandNetworkingGroup -.-> linux/ip("IP Managing") subgraph Lab Skills linux/ls -.-> lab-558791{{"How to check if IPv6 is enabled in Linux"}} linux/cat -.-> lab-558791{{"How to check if IPv6 is enabled in Linux"}} linux/ifconfig -.-> lab-558791{{"How to check if IPv6 is enabled in Linux"}} linux/netstat -.-> lab-558791{{"How to check if IPv6 is enabled in Linux"}} linux/ip -.-> lab-558791{{"How to check if IPv6 is enabled in Linux"}} end

Check IPv6 addresses with ip addr

In this step, you will learn how to check the IPv6 addresses configured on your system using the ip addr command. IPv6 is the latest version of the Internet Protocol, designed to replace IPv4. It provides a much larger address space, among other improvements.

The ip command is a powerful tool in Linux for managing network interfaces, routing, and tunnels. The addr subcommand is used to view and manipulate network addresses.

Open the terminal if you haven't already. You can do this by clicking the Xfce Terminal icon on the left side of the desktop.

Now, type the following command and press Enter:

ip addr

This command will display detailed information about all network interfaces on your system, including both IPv4 and IPv6 addresses.

Look for sections that start with a number followed by a colon and an interface name (like 1: lo: or 2: eth0:). Within each section, look for lines that start with inet6. These lines show the IPv6 addresses assigned to that interface.

For example, you might see output similar to this (output may vary depending on your system configuration):

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe11:2/64 scope link
       valid_lft forever preferred_lft forever

In this example:

  • lo is the loopback interface, typically used for communication within the same machine. It has the IPv6 address ::1/128.
  • eth0 is a standard Ethernet interface. It has the IPv6 address fe80::42:acff:fe11:2/64.

The /128 and /64 parts indicate the network prefix length, similar to the subnet mask in IPv4.

By using ip addr, you can quickly see which interfaces have IPv6 addresses configured and what those addresses are.

Click Continue to proceed to the next step.

Verify IPv6 status in /proc/sys/net/ipv6

In this step, you will explore the /proc filesystem to check the IPv6 status of your system. The /proc filesystem is a virtual filesystem that provides information about processes and other system information. It's a great place to find details about your running Linux kernel.

Specifically, we will look at files within the /proc/sys/net/ipv6/ directory. These files contain parameters that control the behavior of the IPv6 protocol stack.

To view the contents of the /proc/sys/net/ipv6/ directory, you can use the ls command:

ls /proc/sys/net/ipv6/

You will see a list of files and directories. Each file represents a specific IPv6 kernel parameter.

anycast_src_interval  bindv6only  conf  flowlabel_reflect  flowlabel_state  icmp  ip6frag_high_thresh  ip6frag_low_thresh  ip6frag_secret_interval  ip6frag_time  neigh  route  tcp_metrics_hash_size  tcp_metrics_info  tcp_metrics_purge_interval  tcp_metrics_reg_interval  tcp_metrics_req_interval  tcp_metrics_slack  tcp_metrics_sync_interval  tcp_metrics_timeout  udp_metrics_hash_size  udp_metrics_info  udp_metrics_purge_interval  udp_metrics_reg_interval  udp_metrics_req_interval  udp_metrics_slack  udp_metrics_sync_interval  udp_metrics_timeout

One important file is disable. This file indicates whether IPv6 is disabled (1) or enabled (0) system-wide.

To view the content of the disable file, you can use the cat command:

cat /proc/sys/net/ipv6/disable

The output will be either 0 or 1.

0
  • If the output is 0, IPv6 is enabled.
  • If the output is 1, IPv6 is disabled.

Another useful file is conf. This is a directory containing configuration files for each network interface and a default directory for default settings.

Let's look at the contents of the conf directory:

ls /proc/sys/net/ipv6/conf/

You will see directories for each interface (like all, default, eth0, lo).

all  default  eth0  lo

You can then check the IPv6 status for a specific interface, like eth0, by looking at the disable_ipv6 file within its directory:

cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6

This file also contains 0 (enabled) or 1 (disabled) for that specific interface.

0

Exploring the files in /proc/sys/net/ipv6/ provides a low-level view of your system's IPv6 configuration.

Click Continue to move to the next step.

Inspect IPv6 settings with sysctl net.ipv6

In this step, you will use the sysctl command to inspect IPv6 kernel parameters. The sysctl command is used to modify kernel parameters at runtime. It provides a more user-friendly way to view and change the same parameters found in the /proc/sys/ filesystem that you explored in the previous step.

To view all IPv6-related kernel parameters, you can use sysctl with the net.ipv6 prefix.

Type the following command in the terminal and press Enter:

sysctl net.ipv6

This command will output a long list of parameters and their current values. These parameters control various aspects of IPv6 networking behavior, such as address configuration, routing, and security.

net.ipv6.conf.all.accept_dad = 1
net.ipv6.conf.all.accept_ra = 1
net.ipv6.conf.all.accept_redirects = 1
net.ipv6.conf.all.autoconf = 1
net.ipv6.conf.all.dad_transmits = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.all.force_tmo = 0
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.all.hop_limit = 64
net.ipv6.conf.all.keep_addr_on_down = 0
net.ipv6.conf.all.max_desync_factor = 600
net.ipv6.conf.all.mc_forwarding = 0
net.ipv6.conf.all.mtu = 1280
net.ipv6.conf.all.proxy_ndp = 0
net.ipv6.conf.all.regen_max_retry_delay = 1
net.ipv6.conf.all.regen_retry_delay = 1
net.ipv6.conf.all.router_solicit_delay = 1
net.ipv6.conf.all.router_solicit_interval = 600
net.ipv6.conf.all.router_solicit_max_interval = 1200
net.ipv6.conf.all.router_solicits = -1
net.ipv6.conf.all.rtr_probe_interval = 600
net.ipv6.conf.all.suppress_frag_ndisc = 1
net.ipv6.conf.all.temp_prefer_mpatemp = 1
net.ipv6.conf.all.temp_valid_lifetime = 86400
net.ipv6.conf.all.temp_preferred_lifetime = 14400
net.ipv6.conf.all.use_deprecated = 0
net.ipv6.conf.all.use_tempaddr = 0
net.ipv6.conf.all.optimistic_dad = 0
net.ipv6.conf.all.accept_ra_defrtr = 1
net.ipv6.conf.all.accept_ra_pinfo = 1
net.ipv6.conf.all.accept_ra_rtr_pref = 1
net.ipv6.conf.all.accept_ra_mtu = 1
net.ipv6.conf.all.ignore_routes_with_linkdown = 0
net.ipv6.conf.all.drop_unicast_in_l2_multicast = 0
net.ipv6.conf.all.drop_multicast_in_l2_multicast = 0
net.ipv6.conf.all.keep_addr_on_down = 0
net.ipv6.conf.default.accept_dad = 1
net.ipv6.conf.default.accept_ra = 1
net.ipv6.conf.default.accept_redirects = 1
net.ipv6.conf.default.autoconf = 1
net.ipv6.conf.default.dad_transmits = 1
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.default.force_tmo = 0
net.ipv6.conf.default.forwarding = 0
net.ipv6.conf.default.hop_limit = 64
net.ipv6.conf.default.keep_addr_on_down = 0
net.ipv6.conf.default.max_desync_factor = 600
net.ipv6.conf.default.mc_forwarding = 0
net.ipv6.conf.default.mtu = 1280
net.ipv6.conf.default.proxy_ndp = 0
net.ipv6.conf.default.regen_max_retry_delay = 1
net.ipv6.conf.default.regen_retry_delay = 1
net.ipv6.conf.default.router_solicit_delay = 1
net.ipv6.conf.default.router_solicit_interval = 600
net.ipv6.conf.default.router_solicit_max_interval = 1200
net.ipv6.conf.default.router_solicits = -1
net.ipv6.conf.default.rtr_probe_interval = 600
net.ipv6.conf.default.suppress_frag_ndisc = 1
net.ipv6.conf.default.temp_prefer_mpatemp = 1
net.ipv6.conf.default.temp_valid_lifetime = 86400
net.ipv6.conf.default.temp_preferred_lifetime = 14400
net.ipv6.conf.default.use_deprecated = 0
net.ipv6.conf.default.use_tempaddr = 0
net.ipv6.conf.default.optimistic_dad = 0
net.ipv6.conf.default.accept_ra_defrtr = 1
net.ipv6.conf.default.accept_ra_pinfo = 1
net.ipv6.conf.default.accept_ra_rtr_pref = 1
net.ipv6.conf.default.accept_ra_mtu = 1
net.ipv6.conf.default.ignore_routes_with_linkdown = 0
net.ipv6.conf.default.drop_unicast_in_l2_multicast = 0
net.ipv6.conf.default.drop_multicast_in_l2_multicast = 0
net.ipv6.conf.default.keep_addr_on_down = 0
net.ipv6.conf.eth0.accept_dad = 1
net.ipv6.conf.eth0.accept_ra = 1
net.ipv6.conf.eth0.accept_redirects = 1
net.ipv6.conf.eth0.autoconf = 1
net.ipv6.conf.eth0.dad_transmits = 1
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth0.force_tmo = 0
net.ipv6.conf.eth0.forwarding = 0
net.ipv6.conf.eth0.hop_limit = 64
net.ipv6.conf.eth0.keep_addr_on_down = 0
net.ipv6.conf.eth0.max_desync_factor = 600
net.ipv6.conf.eth0.mc_forwarding = 0
net.ipv6.conf.eth0.mtu = 1280
net.ipv6.conf.eth0.proxy_ndp = 0
net.ipv6.conf.eth0.regen_max_retry_delay = 1
net.ipv6.conf.eth0.regen_retry_delay = 1
net.ipv6.conf.eth0.router_solicit_delay = 1
net.ipv6.conf.eth0.router_solicit_interval = 600
net.ipv6.conf.eth0.router_solicit_max_interval = 1200
net.ipv6.conf.eth0.router_solicits = -1
net.ipv6.conf.eth0.rtr_probe_interval = 600
net.ipv6.conf.eth0.suppress_frag_ndisc = 1
net.ipv6.conf.eth0.temp_prefer_mpatemp = 1
net.ipv6.conf.eth0.temp_valid_lifetime = 86400
net.ipv6.conf.eth0.temp_preferred_lifetime = 14400
net.ipv6.conf.eth0.use_deprecated = 0
net.ipv6.conf.eth0.use_tempaddr = 0
net.ipv6.conf.eth0.optimistic_dad = 0
net.ipv6.conf.eth0.accept_ra_defrtr = 1
net.ipv6.conf.eth0.accept_ra_pinfo = 1
net.ipv6.conf.eth0.accept_ra_rtr_pref = 1
net.ipv6.conf.eth0.accept_ra_mtu = 1
net.ipv6.conf.eth0.ignore_routes_with_linkdown = 0
net.ipv6.conf.eth0.drop_unicast_in_l2_multicast = 0
net.ipv6.conf.eth0.drop_multicast_in_l2_multicast = 0
net.ipv6.conf.eth0.keep_addr_on_down = 0
net.ipv6.conf.lo.accept_dad = 1
net.ipv6.conf.lo.accept_ra = 1
net.ipv6.conf.lo.accept_redirects = 1
net.ipv6.conf.lo.autoconf = 1
net.ipv6.conf.lo.dad_transmits = 1
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.lo.force_tmo = 0
net.ipv6.conf.lo.forwarding = 0
net.ipv6.conf.lo.hop_limit = 64
net.ipv6.conf.lo.keep_addr_on_down = 0
net.ipv6.conf.lo.max_desync_factor = 600
net.ipv6.conf.lo.mc_forwarding = 0
net.ipv6.conf.lo.mtu = 65536
net.ipv6.conf.lo.proxy_ndp = 0
net.ipv6.conf.lo.regen_max_retry_delay = 1
net.ipv6.conf.lo.regen_retry_delay = 1
net.ipv6.conf.lo.router_solicit_delay = 1
net.ipv6.conf.lo.router_solicit_interval = 600
net.ipv6.conf.lo.router_solicit_max_interval = 1200
net.ipv6.conf.lo.router_solicits = -1
net.ipv6.conf.lo.rtr_probe_interval = 600
net.ipv6.conf.lo.suppress_frag_ndisc = 1
net.ipv6.conf.lo.temp_prefer_mpatemp = 1
net.ipv6.conf.lo.temp_valid_lifetime = 86400
net.ipv6.conf.lo.temp_preferred_lifetime = 14400
net.ipv6.conf.lo.use_deprecated = 0
net.ipv6.conf.lo.use_tempaddr = 0
net.ipv6.conf.lo.optimistic_dad = 0
net.ipv6.conf.lo.accept_ra_defrtr = 1
net.ipv6.conf.lo.accept_ra_pinfo = 1
net.ipv6.conf.lo.accept_ra_rtr_pref = 1
net.ipv6.conf.lo.accept_ra_mtu = 1
net.ipv6.conf.lo.ignore_routes_with_linkdown = 0
net.ipv6.conf.lo.drop_unicast_in_l2_multicast = 0
net.ipv6.conf.lo.drop_multicast_in_l2_multicast = 0
net.ipv6.conf.lo.keep_addr_on_down = 0
net.ipv6.flowlabel_reflect = 0
net.ipv6.flowlabel_state = 0
net.ipv6.ip6frag_high_thresh = 4194304
net.ipv6.ip6frag_low_thresh = 3145728
net.ipv6.ip6frag_secret_interval = 0
net.ipv6.ip6frag_time = 60
net.ipv6.tcp_metrics_hash_size = 512
net.ipv6.tcp_metrics_info = 1
net.ipv6.tcp_metrics_purge_interval = 600
net.ipv6.tcp_metrics_reg_interval = 1800
net.ipv6.tcp_metrics_req_interval = 300
net.ipv6.tcp_metrics_slack = 10
net.ipv6.tcp_metrics_sync_interval = 300
net.ipv6.tcp_metrics_timeout = 1800
net.ipv6.udp_metrics_hash_size = 512
net.ipv6.udp_metrics_info = 1
net.ipv6.udp_metrics_purge_interval = 600
net.ipv6.udp_metrics_reg_interval = 1800
net.ipv6.udp_metrics_req_interval = 300
net.ipv6.udp_metrics_slack = 10
net.ipv6.udp_metrics_sync_interval = 300
net.ipv6.udp_metrics_timeout = 1800

You can also inspect a specific parameter. For example, to check the system-wide IPv6 disable status using sysctl, you can use:

sysctl net.ipv6.conf.all.disable_ipv6

The output will show the parameter name and its value:

net.ipv6.conf.all.disable_ipv6 = 0

This confirms that IPv6 is enabled system-wide, matching what you saw in the /proc filesystem.

The sysctl command is a convenient way to view and modify kernel parameters without directly interacting with the files in /proc/sys/.

Click Continue to complete this lab.

Summary

In this lab, you learned how to check if IPv6 is enabled on a Linux system by examining network configurations. You started by using the ip addr command to display network interface details and identify assigned IPv6 addresses. This command provides a comprehensive view of both IPv4 and IPv6 addresses configured on the system's network interfaces.

Following that, you explored the /proc/sys/net/ipv6 directory to verify the kernel's IPv6 status by inspecting specific files within this virtual filesystem. Finally, you utilized the sysctl net.ipv6 command to inspect various kernel parameters related to IPv6, offering a deeper insight into the system's IPv6 settings and configuration.