centos和opensuse单网卡双ip配置
opensuse双卡配置
- 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
- #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即可