Chinaunix首页 | 论坛 | 博客
  • 博客访问: 82599
  • 博文数量: 15
  • 博客积分: 315
  • 博客等级: 二等列兵
  • 技术积分: 180
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-28 08:37
文章分类
文章存档

2012年(2)

2011年(13)

我的朋友

分类: LINUX

2011-12-12 15:30:19

  1. 1、插件安装
  2. apt-get install ifenslave
  3. 2、配置interfaces
  4. auto lo bond0 eth0 eth1
  5. iface bond0 inet static
  6. address 192.168.4.134
  7. netmask 255.255.255.0
  8. network 192.168.4.0
  9. broadcast 192.168.4.255
  10. gateway 192.168.4.1
  11. up /sbin/ifenslave bond0 eth0
  12. up /sbin/ifenslave bond0 eth1
  13. # The primary network interface
  14. iface lo inet loopback
  15. iface eth0 inet static
  16. address 192.168.4.135
  17. netmask 255.255.255.0
  18. iface eth1 inet static
  19. address 192.168.4.136
  20. netmask 255.255.255.0
  21. 3、把bond模块加入到/etc/modules
  22. alias bond0 bonding
  23. options bond0 mode=balance-alb miimon=100 max_bonds=2
  24. 说明:miimon是用来进行链路监测的。 比如:miimon=100,那么系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路;mode的值表示工作模式,他共有0,1,2,3四种模式,常用的为0,1两种。
  25. mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作。
  26. mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,也就是说默认情况下只有一块网卡工作,另一块做备份.
  27. bonding只能提供链路监测,即从主机到交换机的链路是否接通。如果只是交换机对外的链路down掉了,而交换机本身并没有故障,那么bonding会认为链路没有问题而继续使用 .
  28. 4、重启网卡
  29. 5、加入开机启动
  30. modprobe bonding max_bonds=2
  31. 创建一个bond设备,三个简单的步骤即可搞定:
  32. (1)首先要保证相应的驱动程序已经加载:
  33. localhost@root ~# modprobe bonding
  34. 或 modprobe <3c59x| eepro100|pcnet32|tulip|...>
  35. (2)其次给等梆定bond设备分配IP地址
  36. localhost@root ~# ifconfig bond0 netmask <子网掩码> broadcast <广播地址 >
  37. 例如 ifconfig bond0 192.168.1.242 netmask 255.255.255.0 broadcast 172.31.3.254
  38. (3)最后将所有要梆定的物理网卡接口添加到bond设备中去
  39. localhost@root ~# ifenslave bond0 [{-f|--force} bond0 eth0 [ eth1 [eth2]...]
  40. 例如 ifenslave bond0 eth0 eth1 梆定了eth0 eth1两个网卡设备。 --force 表示强制进行梆定
  41. 创建好bond设备后,就可以像一般的网卡设备一样使用了
  42. 如启动bond0: # ifconfig bond0 up
  43. 停用bond0: # ifconfig bond0 down
  44. 在不停用bond0的情况下添加接口: # ifenslave {-d| --detach} bond0 eth0 [eth1 [eth2]...]
  45. --detach表示"附加"的意思
  46. 改变活动的从设备: # ifenslave {-c|--change-active} bond0 eth0
  47. --change-acitve 表示"改变活动的从设备"的意思
  48. 显示主接口(指bond0)信息: # ifenslave bond0
  49. 显示所以接口信息: # ifenslave {-a|--all-interfaces}
  50. --all-interfaces 表示"所有接口"
阅读(7344) | 评论(2) | 转发(2) |
给主人留下些什么吧!~~

4647357902011-12-14 10:24:10

小小小毛驴: 网卡也能重启??.....
重启网络服务

小小小毛驴2011-12-14 00:37:50

网卡也能重启??