免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1713 | 回复: 5

[网络管理] 双网卡绑定问题 [复制链接]

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-06-20 06:20:00
发表于 2013-09-09 15:32 |显示全部楼层
本帖最后由 echoaix 于 2013-09-09 15:33 编辑

IBM 刀片小机 运行linux 5片刀。
#uname -a
2.6.32-343.el6.ppc64 #1 SMP Mon Nov 19 16:49:16 EST 2012 ppc64 ppc64 ppc64 GNU/Linux
每片刀上eth0和eth1双网卡绑定。
ifcfg-bong0内容:
DEVICE=bond0                     
IPADDR=192.168.3.51               
NETMASK=255.255.255.0            
NETWORK=192.168.3.0               
BROADCAST=192.168.3.255           
ONBOOT=yes                        
GATEWAY=192.168.3.254            
BOOTPROTO=static                  
USERCTL=no                        
BONDING_OPTS="mode=1 miimon=500"            
DEFROUTE=yes

ifcfg-eth0内容
DEVICE=eth0     
TYPE=Ethernet   
ONBOOT=yes      
BOOTPROTO=none  
USERCTL=no      
MASTER=bond0   
SLAVE=yes      

ifcfg-eth1内容
DEVICE=eth1     
TYPE=Ethernet   
ONBOOT=yes      
BOOTPROTO=none  
USERCTL=no      
MASTER=bond0   
SLAVE=yes

/etc/rc.d/rc.local的内容
ifenslave bond0 eth0 eth1         
route add default gw 192.168.3.254

现在的问题 只有一台正常路由正常
正常的路由:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.3.0     *               255.255.255.0   U     0      0        0 bond0
link-local      *               255.255.0.0     U     1004   0        0 bond0
default         192.168.3.254   0.0.0.0         UG    0      0        0 bond0

其它的不对的:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.3.0     *               255.255.255.0   U     0      0        0 bond0
192.168.3.0     *               255.255.255.0   U     1      0        0 eth1
192.168.3.0     *               255.255.255.0   U     1      0        0 eth0
link-local      *               255.255.0.0     U     1004   0        0 bond0
default         192.168.3.254   0.0.0.0         UG    0      0        0 bond0
default         192.168.3.254   0.0.0.0         UG    0      0        0 eth0  

配置完全都一样的。网卡文件也一样的(只是IP设置不同)。咨询一下什么问题,谢谢各位了。  



                     

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
发表于 2013-09-09 15:42 |显示全部楼层
去掉rc.local里面的内容呢?

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
发表于 2013-09-09 15:52 |显示全部楼层
  1. 1. For a channel bonding interface to be valid, the bonding module must be loaded. To ensure that the module is loaded when the channel bonding interface is brought up, create a new file as root named +bonding.conf+** in the +/etc/modprobe.d/+ directory. Note that you can name this file anything you like as long as it ends with a .conf extension. Insert the following line in this new file:
  2. /etc/modprobe.d/bonding.conf :
  3. alias bond<N> bonding
  4. Replace <N> with the  interface number, such as 0. For each configured channel bonding  interface, there must be a corresponding entry in your new  /etc/modprobe.d/<bonding>.conf file.
  5. 2. To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bond<N> , replacing <N> with the number for the interface, such as 0. The contents of the file can be identical to whatever type of interface is getting bonded, such as an Ethernet interface. The only difference is that the DEVICE= directive must be bond<N> , replacing <N> with the number for the interface.
  6. The following is a sample channel bonding configuration file:
  7. DEVICE=bond0
  8. IPADDR=192.168.1.1
  9. NETMASK=255.255.255.0
  10. ONBOOT=yes
  11. BOOTPROTO=none
  12. USERCTL=no
  13. BONDING_OPTS="<bonding parameters separated by spaces>"
  14. 3. After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding the MASTER= and SLAVE= directives to their configuration files. The configuration files for each of the channel-bonded interfaces can be nearly identical.  For example, if two Ethernet interfaces are being channel bonded, both eth0 and eth1 may look like the following example:
  15. DEVICE=eth<N>
  16. BOOTPROTO=none
  17. ONBOOT=yes
  18. MASTER=bond0
  19. SLAVE=yes
  20. USERCTL=no
  21. In this example, replace <N> with the numerical value for the interface.
  22. 4. Restart the service network and make the bond0 up.
  23. service network restart
  24. *Note :*
  25. Parameters for the bonding kernel module must be specified as a space-separated list in the BONDING_OPTS="<bonding parameters>"  directive in the ifcfg-bond<N>  interface file. Do not specify options for the bonding device in /etc/modprobe.d/<bonding>.conf, or in the deprecated /etc/modprobe.conf file.
复制代码
按RH的方式来吧,试试。路由尽量别写RC.LOCAL,这文件只在开机时候执行一次。其他时候网卡一重启就丢路由了。建议路由写到配置文件里。

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-06-20 06:20:00
发表于 2013-09-09 16:16 |显示全部楼层
chenyx 发表于 2013-09-09 15:42
去掉rc.local里面的内容呢?

谢谢
去掉也不行的,只是少了bond0的这条路由,夸网段直接不通了。

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-06-20 06:20:00
发表于 2013-09-09 16:37 |显示全部楼层
补充一下:
正常的机器上 eth0和eth1 都是没有IP地址的。
# ifconfig
bond0     Link encap:Ethernet  HWaddr 34:40:B5:CF:F0:5A  
          inet addr:192.168.3.51  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::3640:b5ff:fecf:f05a/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:285 errors:0 dropped:0 overruns:0 frame:0
          TX packets:215 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:22316 (21.7 KiB)  TX bytes:22055 (21.5 KiB)

eth0      Link encap:Ethernet  HWaddr 34:40:B5:CF:F0:5A  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:274 errors:0 dropped:0 overruns:0 frame:0
          TX packets:215 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21810 (21.2 KiB)  TX bytes:22055 (21.5 KiB)

eth1      Link encap:Ethernet  HWaddr 34:40:B5:CF:F0:5A  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:506 (506.0 b)  TX bytes:0 (0.0 b)

不正常的机器: eth0和eth1 都是有IP地址的。
# ifconfig
bond0     Link encap:Ethernet  HWaddr 34:40:B5:CF:F3:BA  
          inet addr:192.168.3.55  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::3640:b5ff:fecf:f3ba/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:53321 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31784 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3082003 (2.9 MiB)  TX bytes:2318806 (2.2 MiB)

eth0      Link encap:Ethernet  HWaddr 34:40:B5:CF:F3:BA  
          inet addr:192.168.3.55  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:42207 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31784 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2480752 (2.3 MiB)  TX bytes:2318806 (2.2 MiB)

eth1      Link encap:Ethernet  HWaddr 34:40:B5:CF:F3:BA  
          inet addr:192.168.3.55  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:11114 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:601251 (587.1 KiB)  TX bytes:0 (0.0 b)

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
发表于 2013-09-09 16:57 |显示全部楼层
这个就让人费解了.
看你的ifconfig的输出,所有的mac都是一样的,按道理bond已经成功了.为什么ethX还会被设置上ip呢,奇怪
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP