bannerAds
Global
language language

Product

Doc

Support

Menu 

SiliCloud Help Document Center

search

Popular search terms

CentOS7 设置多IP

Update time 2023-01-14 16:52  Version v2.8
I want feedback 
Collect My collection

CentOS7 设置多IPv4/多IPv6


第一步,确定网卡名称和配置文件的位置

假设:

    网卡名称:eth0

    对应配置文件是:/etc/sysconfig/network-scripts/ifcfg-eth0

    IPv4:172.16.0.55/24 , 172.16.0.66/24

    IPv6:2400:38e0:0:499e::18d/64 , 2400:38e0:0:499e::1c5/64, 2400:38e0:0:499e::4a5/64


第二步,修改 "/etc/sysconfig/network-scripts/ifcfg-eth0"

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
MTU=1436
NAME=eth0
DEVICE=eth0
ONBOOT=yes
DNS1=8.8.8.8
IPADDR0="172.16.0.55"
IPADDR1="172.16.0.66"
PREFIX=24
GATEWAY=172.16.0.1
NM_CONTROLLED=no
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
DNS2="2001:4860:4860::8888"
IPV6ADDR="2400:38e0:0:499e::18d/64"
IPV6ADDR_SECONDARIES="2400:38e0:0:499e::1c5/64 \
2400:38e0:0:499e::4a5/64"
IPV6_DEFAULTGW="2400:38e0:0:499e::1"


第三步,生效:

执行:

systemctl restart network.service

重启(可选):

init 6

注:重启后,依然有效。

Do you have any suggestions for this document?

Your rating for this document