CentOS 6 单网卡绑定双IP
Posted walkersss
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6 单网卡绑定双IP相关的知识,希望对你有一定的参考价值。
CentOS 6 单网卡绑定双IP
OS:CnetOS 6.8
初始网卡配置文件
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.110
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489157101
方法一:在原网卡配置文件直接增加新IP
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.110
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
IPADDR2=192.168.1.111
PREFIX2=24
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489129249
方法二:新增网卡配置文件:
[root@localhost /]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.111
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489130355
修改网卡配置文件后,需要重启网络服务才会生效:
[root@localhost /]# service network restart
以上是关于CentOS 6 单网卡绑定双IP的主要内容,如果未能解决你的问题,请参考以下文章