方式一:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
编辑网卡信息
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=103.147.1.100
NETMASK=255.255.255.0
GATEWAY=103.147.1.1
IPV6INIT=no
DNS1=223.6.6.6
DNS2=114.114.114.114
----------------------------------------
加入以下IP地址
IPADDR1=103.147.1.101
IPADDR2=103.147.1.102
-------------完成后如下↓---------
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=103.147.1.100
IPADDR1=103.147.1.101
IPADDR2=103.147.1.102
NETMASK=255.255.255.0
GATEWAY=103.147.1.1
IPV6INIT=no
DNS1=223.6.6.6
DNS2=114.114.114.114
重启网络服务生效或重新启动系统:
service network restart
-----------------------------------------------------------
方式二:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
编辑网卡信息
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=103.147.1.100
NETMASK=255.255.255.0
GATEWAY=103.147.1.1
IPV6INIT=no
DNS1=223.6.6.6
DNS2=114.114.114.114
----------------------------------------
加入以下
IPADDR2=103.147.1.101
NETMASK2=255.255.255.0
-------------完成后如下↓---------
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=103.147.1.100
NETMASK=255.255.255.0
IPADDR2=103.147.1.101
NETMASK2=255.255.255.0
GATEWAY=103.147.1.1
IPV6INIT=no
DNS1=223.6.6.6
DNS2=114.114.114.114
重启网络服务生效或重新启动系统:
service network restart
---------------------------------
方式三:
仿照/etc/sysconfig/network-scripts//ifcfg-eth0
网卡配置文件,增加一个虚拟端口ifcfg-eth1
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
vim /etc/sysconfig/network-scripts/ifcfg-eth1
写入网卡信息
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=103.147.1.101
NETMASK=255.255.255.0
GATEWAY=103.147.1.1
IPV6INIT=no
DNS1=223.6.6.6
DNS2=114.114.114.114
----------------------------------
保存退出,重启服务器!