Linux单网卡绑多IP以及多网卡共用单IP

just posted @ 2008年12月30日 00:10 in linux with tags linux 多ip , 1504 阅读

1、单网卡绑定多IP在Redhat系列中的实现方法
  假设需要绑定多IP的网卡是eth0,请在/etc/sysconfig/network-scripts目录里面创建一个名为ifcfg-eth0:0的文件,
  内容样例为:
  DEVICE=”eth0:0″
  IPADDR=”192.168.0.2″
  BROADCAST=”172.168.0.255″
  NETMASK=”255.255.255.0″
  ONBOOT=”yes”
  其中的DEVICE为设备的名称,
  IPADDR为此设备的
IP地址,
  BROADCAST是
广播地址,
  NETMASK为子网
掩码,
  ONBOOT 表示在系统启动时自动启动。
  如果需要再绑定多一个IP地址,
  只需要把文件名和文件内的DEVICE中的eth0:x加一即可。
  LINUX最多可以支持255个IP别名
  2、普遍适用的单网卡绑定多IP实现方法
  ifconfig eth0:1 192.168.0.3 broadcast 192.168.0.255 netmask 255.255.255.0
  可以把上述命令加在启动自运行文件里面,在Gentoo下是/etc/conf.d/local.start,而某些版本的Linux是/etc/rc.d/rc.local。
  3、多网卡共用单IP的实现方法
  使用多块网卡虚拟成为一块网卡,具有相同的IP地址。这项技术其实在sun和cisco中已经存在,分别称为Trunking和 etherchannel技术,在linux中,这种技术称为bonding。因为bonding在内核2.4.x中已经包含了,只需要在编译的时候把网 络设备选项中的 Bonding driver support选中就可以了。
  然后,重新编译核心,重新起动计算机,执行如下命令:
  ismod bonding
  ifconfig eth0 down
  ifconfig eth1 down
  ifconfig bond0 ipaddress
  ifenslave bond0 eth0
  ifenslave bond0 eth1
  现在两块网卡已经象一块一样工作了,这样可以提高
集群节点间的数据传输。
  你最好把这几句写成一个脚本,再由/etc/rc.d/rc.local或者/etc/conf.d/local.start调用,以便一开机就生效。

  • 无匹配
ZENBroadband 说:
2022年8月09日 17:38

Zen Internet Broadband is considered as the fastest & reliable broadband for both home & business purpose. The company is having the strength of approximately 413 employees & all of them being dedicated & hard working people making the internet services very reliable. ZENBroadband Because of the hard work of the employees as well as CEO (Paul Stobard) & Chairman (Richard Tang), the company won several awards in 2006 at ISPA i.e. Internet Service Provider’s Association.

MBOSE Model Paper 说:
2022年9月03日 22:44

MBOSE SSLC Model Paper 2022 Purpose of Providing help to the Board Students. Through This Paper they are able to get aware the type of Questions asked in the Board Exam. While Preparing this Meghalaya Board SSLC Question Paper 2022 some help have been taken from Previous Paper to Practice More, you can take help from MBOSE SSLC Annual Exam 2022. MBOSE Model Paper Here we are Providing the Meghalaya Board 10th Question Paper 2022 Along with its Solution. All these Solutions are Explained by the Subject Experts. Read the Solutions given here to Learn the Right Technique to write Perfect Exam.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter