红联Linux门户
Linux帮助

CentOS和openSUSE单网卡双ip配置记录

发布时间:2014-11-05 21:37:08来源:linux网站作者:itnihao

CentOS单网卡双ip
cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
内容如下。eth0的ip是192.168.16.150网关是192.168.16.1
[root@localhost network-scripts]# cat ifcfg-eth0  
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT="yes"
HWADDR=00:0C:29:73:7B:2A
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.16.150   eth0的ip
PREFIX=24
GATEWAY=192.168.16.1    eth0的网关
DNS1=114.114.144.144
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
[root@localhost network-scripts]# cat ifcfg-eth0:0
DEVICE="eth0:0"
NM_CONTROLLED="yes"
ONBOOT="yes"
HWADDR=00:0C:29:73:7B:2A
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.150  eth0:0的ip
PREFIX=24
GATEWAY=192.168.1.1    eth0:0的网关
DNS1=114.114.144.144
DEFROUTE=yes          
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0:0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03


opensuse双卡配置

#cat /etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='192.168.2.254/27'   eth0的ip
MTU=''
NAME='80003ES2LAN Gigabit Ethernet Controller (Copper)'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
IPADDR_eth01='10.10.10.254'   eth0:0的ip
NETMASK_eth01='255.255.255.0'
LABEL_eth01='0'

配置文件改完,只需service network restart即可。