linux下如何用单网卡配置多IP

    文章来源:中国互联 更新时间:2013-1-23 19:07:58
分享:

1、通过复制一个ifcfg-eth0:1配置文件实现:
  cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
  vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
  # Intel Corporation 82566DC Gigabit Network Connection
  DEVICE=eth0
  BOOTPROTO=none
  BROADCAST=218.95.37.255
  HWADDR=00:19:d1:34:2d:b8
  IPADDR=218.95.37.250
  NETMASK=255.255.255.192
  NETWORK=218.95.37.192
  ONBOOT=yes
  GATEWAY=218.95.37.193
  TYPE=Ethernet
  ifconfig eht0:1 up
  2、临时方式(重启后就丢失了):
  ifconfig eth0:1 192.168.0.2 netmask 255.255.255.0 up
  3、脚本方式实现:
  #!/bin/sh
  eth01=/etc/sysconfig/network-scripts/ifcfg-eth0:1
  touch $eth01
  echo DEVICE=eth0:1》$eth01
  echo BOOTPROTO=none》$eth01
  echo IPADDR=192.168.40.76》$eth01
  echo NETMASK=255.255.255.0》$eth01
  echo ONBOOT=yes》$eth01
  /etc/init.d/network restart

文章来源:http://www.163ns.com,转载请注明!

在线咨询
  • 在线时间
  • 8:00-21:00
linux下如何用单网卡配置多IP-中国互联

linux下如何用单网卡配置多IP

    文章来源:中国互联 更新时间:2013-1-23 19:07:58
分享:

1、通过复制一个ifcfg-eth0:1配置文件实现:
  cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
  vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
  # Intel Corporation 82566DC Gigabit Network Connection
  DEVICE=eth0
  BOOTPROTO=none
  BROADCAST=218.95.37.255
  HWADDR=00:19:d1:34:2d:b8
  IPADDR=218.95.37.250
  NETMASK=255.255.255.192
  NETWORK=218.95.37.192
  ONBOOT=yes
  GATEWAY=218.95.37.193
  TYPE=Ethernet
  ifconfig eht0:1 up
  2、临时方式(重启后就丢失了):
  ifconfig eth0:1 192.168.0.2 netmask 255.255.255.0 up
  3、脚本方式实现:
  #!/bin/sh
  eth01=/etc/sysconfig/network-scripts/ifcfg-eth0:1
  touch $eth01
  echo DEVICE=eth0:1》$eth01
  echo BOOTPROTO=none》$eth01
  echo IPADDR=192.168.40.76》$eth01
  echo NETMASK=255.255.255.0》$eth01
  echo ONBOOT=yes》$eth01
  /etc/init.d/network restart

文章来源:http://www.163ns.com,转载请注明!

在线咨询
  • 在线时间
  • 8:00-21:00