CentOS单网卡绑定双IP
初始网卡配置文件
[root@Container ~]# vim /etc/sysconfig/network-scripts/ifcfg-enp3s0f0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
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
NAME=enp3s0f0
UUID=64c6147b-3a90-496b-bf00-4cfee85deebb
DEVICE=enp3s0f0
ONBOOT=yes
IPADDR=202.205.161.98
PREFIX=23
IPV6_PRIVACY=no
GATEWAY=202.205.160.1
DNS1=202.205.161.113
DNS2=202.205.160.3
DNS3=219.142.50.126
方法一:在原网卡配置文件直接增加新IP
[root@Container ~]# vim /etc/sysconfig/network-scripts/ifcfg-enp3s0f0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
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
NAME=enp3s0f0
UUID=64c6147b-3a90-496b-bf00-4cfee85deebb
DEVICE=enp3s0f0
ONBOOT=yes
IPADDR=202.205.161.98
PREFIX=23
IPV6_PRIVACY=no
GATEWAY=202.205.160.1
DNS1=202.205.161.113
DNS2=202.205.160.3
DNS3=219.142.50.126
NAME=enp3s0f0
IPADDR2=202.205.161.112
PREFIX=23
GATEWAY=202.205.160.1
方法二:新增网卡配置文件:
新配置文件 修改IP地址及网卡名称
DEVICE=enp3s0f0:0 IPADDR=202.205.161.112
[root@Container ~]# cp /etc/sysconfig/network-scripts/ifcfg-enp3s0f0 /etc/sysconfig/network-scripts/ifcfg-enp3s0f0:0
[root@Container ~]# vim /etc/sysconfig/network-scripts/ifcfg-enp3s0f0:0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
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
NAME=enp3s0f0
UUID=64c6147b-3a90-496b-bf00-4cfee85deebb
DEVICE=enp3s0f0:0
ONBOOT=yes
IPADDR=202.205.161.112
PREFIX=23
IPV6_PRIVACY=no
GATEWAY=202.205.160.1
DNS1=202.205.161.113
DNS2=202.205.160.3
DNS3=219.142.50.126
修改网卡配置文件后,需要重启网络服务才会生效:
systemctl restart network
绑定跨网段IP地址
可能会有网络波动闪断问题
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
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
NAME=eth1
UUID=6d3be542-fc48-4a27-b051-9bc03daa4613
DEVICE=eno1
ONBOOT=yes
IPADDR=202.205.161.96
PREFIX=23
GATEWAY=202.205.160.1
DNS1=202.205.160.3
DNS2=219.142.50.126
IPV6_PRIVACY=no
IPADDR1=219.143.195.83
PREFIX1=28
GATEWAY=219.143.195.81
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/160310.html