服务器多IP的网卡设置方法,Linux添加/新增/修改IP
首先打开网卡文件:“/etc/sysconfig/network-scripts” 看到 “ifcfg-eth0” 默认信息如下
DEVICE=seth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV6INIT=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
NAME=VPSNetCard
HWADDR=00:15:5d:44:1b:pp
IPADDR=43.111.111.2
NETMASK=255.255.255.0
GATEWAY=43.111.111.1
DNS1=8.8.8.8
DNS2=8.8.4.4
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV6INIT=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
NAME=VPSNetCard
HWADDR=00:15:5d:44:1b:pp
IPADDR=43.111.111.2
NETMASK=255.255.255.0
GATEWAY=43.111.111.1
DNS1=8.8.8.8
DNS2=8.8.4.4
新增IP的最佳办法为:
修改此文件为:
DEVICE=seth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV6INIT=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
NAME=VPSNetCard
HWADDR=00:15:5d:44:1b:pp
IPADDR=43.111.111.2
NETMASK=255.255.255.0
GATEWAY=43.111.111.1
IPADDR2=43.111.111.3
DNS1=8.8.8.8
DNS2=8.8.4.4
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV6INIT=no
IPV4_FAILURE_FATAL=yes
PEERDNS=yes
NAME=VPSNetCard
HWADDR=00:15:5d:44:1b:pp
IPADDR=43.111.111.2
NETMASK=255.255.255.0
GATEWAY=43.111.111.1
IPADDR2=43.111.111.3
DNS1=8.8.8.8
DNS2=8.8.4.4
最后重启一下网卡:service network restart
---
转载请注明本文标题和链接:《服务器多IP的网卡设置方法,Linux添加/新增/修改IP》
发表评论