Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to configure IPv6 address in Linux

Shulou Source: shulou.com Published: 2022-06-01 14:50:04 10月03日 Update

In this issue, the editor will bring you about how to configure IPv6 addresses in Linux. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Linux supports IPv6 after kernel version 2.2.0. Check whether the / proc/net/if_inet6 file exists to determine whether your system supports IPv6.

If not, try the following command to load the IPv6 module:

# modprobe ipv6

After successfully loading, you can use the IPv6 environment, and the system will automatically obtain the IPv6 address.

IPv6 related commands:

# ifconfig eth0 inet6 add 2001:da8:2004:1000:202:116:160:41/64 (manually add and configure fixed IPv6 address)

# route-An inet6 add default gw 2001:da8:2004:1000::1 (add default route)

# ping6 ipv6.scau.edu.cn

PING ipv6.scau.edu.cn (2001:da8:2004:1000:202:116:160:48) 56 data bytes

64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=0 ttl=64 time=0.020 ms

64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=1 ttl=64 time=0.019 ms

64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=2 ttl=64 time=0.014 ms

This display indicates that IPv6 has been configured successfully.

Linux Settings isatap Tunnel configuration IPv6

The Linux settings are as follows:

Ip tunnel add sit1 mode sit remote 192.168.253.49 local a.b.c.d

Ifconfig sit1 up

Ifconfig sit1 add 2001:da8:2004:2301:0:5efe:a.b.c.d

Route-An inet6 add:: / 0 fe80::5efe:192.168.253.49

Note: please use your real IPv4 address instead of the a.b.c.d above

After ifconfig is configured, you should see a V6 address prefixed with 2001:da8:2004:2301, hostid is 5efe:a.b.c.d, where a.b.c.d is your real IPV4 address.

The following supplementary content:

Debian

The code is as follows:

Vi / etc/network/interfaces

# / etc/network/interfaces-configuration file for ifup (8), ifdown (8)

# The loopback interface

# automatically added when upgrading

Auto lo

Iface lo inet loopback

Auto eth0

Iface eth0 inet6 static

Address 2001:da8:2:10d::2

Netmask 64

Up route-An inet6 add default gw 2001:da8:2:10d::1 dev $IFACE

Iface eth0 inet static

Address 58.1.4.74

Netmask 255.255.255.0

Up route add default gw 58.1.4.1 dev $IFACE

Redhat CentOS Fedora

The code is as follows:

[root@server4 ~] # vi / etc/sysconfig/network-scripts/ifcfg-eth0

# Broadcom Corporation NetXtreme BCM5704 Gigabit Ethernet

DEVICE=eth0

BOOTPROTO=none

HWADDR= 00:09: 3D:22:E1:40

IPADDR=202.120.1.1

NETMASK=255.255.255.240

ONBOOT=yes

GATEWAY=202.120.1.254

TYPE=Ethernet

USERCTL=no

IPV6INIT=yes

PEERDNS=yes

IPV6ADDR=2001:da8:8003:801:202:120:1:1

Static default gateway settin

The code is as follows:

[root@server4 ~] # vi / etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=server4

GATEWAY=202.120.1.254

IPV6_DEFAULTGW=2001:da8:8003:801::1%eth0

This is how to configure the IPv6 address in the Linux shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Address configuration code content a.b.c.d success command system analysis support professional medium and small content-rich kernel prefix that is manual file article more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi macOS Shulou Technology Docker Apple