Ubuntu16.04 单网卡配置多IPv6地址

注意:在此之前必须先分配好网络地址,才能添加。

一、修改/etc/network/interfaces 文件内容

 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

auto eth0
iface eth0 inet dhcp
pre-up sleep 2
#以下是第一个IPv6地址
iface eth0 inet6 static
address 2605:6400:0020:1b99::2
netmask 48
gateway 2605:6400:20::1

#以下是第二个IPv6地址
auto eth0:0
iface eth0:0 inet6 static
address 2605:6400:0020:1b99::3
netmask 48
gateway 2605:6400:20::1

#以下是第三个IPv6地址
auto eth0:1
iface eth0:1 inet6 static
address 2605:6400:0020:1b99::4
netmask 48
gateway 2605:6400:20::1

#以下是第四个IPv6地址
auto eth0:2
iface eth0:2 inet6 static
address 2605:6400:0020:1b99::5
netmask 48
gateway 2605:6400:20::1

二、重启网络、查看IP信息

 
  //重启网络服务
[email protected]:~# systemctl restart networking.service
  //查看IP信息
[email protected]:~# ip add

发表评论