centos和opensuse单网卡双ip配置

  1. centos单网卡双ip  
  2. cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0  
  3. 内容如下。eth0的ip是192.168.16.150网关是192.168.16.1  
  4. [root@localhost network-scripts]# cat ifcfg-eth0    
  5. DEVICE="eth0" 
  6. NM_CONTROLLED="yes" 
  7. ONBOOT="yes" 
  8. HWADDR=00:0C:29:73:7B:2A  
  9. TYPE=Ethernet 
  10. BOOTPROTO=none 
  11. IPADDR=192.168.16.150   eth0的ip
  12. PREFIX=24 
  13. GATEWAY=192.168.16.1  eth0的网关
  14. DNS1=114.114.144.144  
  15. DEFROUTE=yes 
  16. IPV4_FAILURE_FATAL=yes 
  17. IPV6INIT=no 
  18. NAME="System eth0" 
  19. UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  
  20. [root@localhost network-scripts]# cat ifcfg-eth0:0  
  21. DEVICE="eth0:0" 
  22. NM_CONTROLLED="yes" 
  23. ONBOOT="yes" 
  24. HWADDR=00:0C:29:73:7B:2A  
  25. TYPE=Ethernet 
  26. BOOTPROTO=none 
  27. IPADDR=192.168.1.150  eth0:0的ip
  28. PREFIX=24 
  29. GATEWAY=192.168.1.1   eth0:0的网关
  30. DNS1=114.114.144.144  
  31. DEFROUTE=yes 
  32. IPV4_FAILURE_FATAL=yes 
  33. IPV6INIT=no 
  34. NAME="System eth0:0" 
  35. UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 
opensuse双卡配置
  1. #cat /etc/sysconfig/network/ifcfg-eth0
  2. BOOTPROTO='static' 
  3. BROADCAST='' 
  4. ETHTOOL_OPTIONS='' 
  5. IPADDR='192.168.2.254/27'  eth0的ip
  6. MTU='' 
  7. NAME='80003ES2LAN Gigabit Ethernet Controller (Copper)' 
  8. NETWORK='' 
  9. REMOTE_IPADDR='' 
  10. STARTMODE='auto' 
  11. USERCONTROL='no' 
  12. IPADDR_eth01='10.10.10.254'  eth0:0的ip
  13. NETMASK_eth01='255.255.255.0' 
  14. LABEL_eth01='0' 

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