设为首页 收藏本站
查看: 1379|回复: 0

centos 6.2 网卡聚合及Cisco交换机链路聚合

[复制链接]
YunVN网友  发表于 2015-5-24 10:37:03 |阅读模式
  一、配置环境
  centos 6.2系统。网卡1口和2口做链路聚合。    交换机网口 6口和7口。
  二、服务器操作步骤
  1.创建一个channel bonding interface



#vi /etc/sysconfig/network-scripts/ifcfg-bond0
添加如下几行:
GATEWAY=192.168.10.1
DNS1=202.106.0.20
DEVICE=bond0
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
IPADDR=192.168.10.100
ONBOOT=yes
USERCTL=no

  也可以使用 setup 命令进入网卡配置模式,添加一块行的网卡:   --> Ethernet--> Name :bond0 --> Device:bond0  ……保存后-->进入bond0的配置文件,将ONBOOT参数改为yes。
  2.修改网卡em1和em2 配置



DEVICE=em1  ## 网卡em1:DEVICE 参数为em1   网卡em2:DEVICE 参数为em2
ONBOOT=no
TYPE=Ethernet
MASTER=bond0
BOOTPROTO=none
USERCTL=no
SLAVE=yes
IPV6INIT=no
  3.编辑bond0.conf配置文件,及配置bond模式
  创建bond.config配置文件:



vi /etc/modprobe.d/bond0.conf
添加如下行:
alias  bond0 bonding
options bond0 miimon=100 mode=1

miimon 是链路监测的时间间隔单位是毫秒,miimon=100的意思就是,每100毫秒检测网卡和交换机之间是否连通,如不通则使用另外的链路。

  重启网卡服务:service network restart  (在交换机也做好channel后再重启网卡服务,这样可以和服务器不断开连接)
  如果还是看不到bond0, 关闭 NetworkManager服务。重启网卡,再次查看。
  注:
mode的值表示工作模式,他共有0,1,2,3,4,5,6这7种模式,常用的为0,1两种。
mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作。
mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,也就是说默认情况下只有一块网卡工作,另一块做备份.
mode=2表示balance-x,提供负载均衡和冗余功能。
mode=3表示broadcast,这个模式提供容错性。
mode=4表示802.3ad,提供了ethtool的迅速,以及使用了802.3ad模式
mode=5表示balance-tlb,自动适应负载均衡,自动切换故障。在此基础上Ethtool支持驱动。
mode=6表示在5模式的基础上优化了arp的广播信息。
  bonding模式介绍和所需条件详见:
  http://blog.chinaunix.net/uid-49097-id-78251.html
  
  三、交换机下的配置:



(config)#interface range gigabitEthernet 0/6 -7
(config-if-range)#switchport access vlan 10
(config-if-range)#channel-protocol lacp
(config-if-range)#channel-group 3 mode active
(config)#interface port-channel 3
(config-if)#switchport access vlan 10
  
  
  四、主机show 信息:
  [iyunv@localhost bonding]# ifconfig
bond0     Link encap:Ethernet  HWaddr 14:FE:B5:C8:1A:B7  
          inet addr:192.168.10.100  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::16fe:b5ff:fec8:1ab7/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:60730879 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10640 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11017881974 (10.2 GiB)  TX bytes:1221132 (1.1 MiB)
  em1       Link encap:Ethernet  HWaddr 14:FE:B5:C8:1A:B7  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:30367565 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5315 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5509317809 (5.1 GiB)  TX bytes:607884 (593.6 KiB)
          Interrupt:24 Memory:e6000000-e6012800
  em2       Link encap:Ethernet  HWaddr 14:FE:B5:C8:1A:B7  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:30363314 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5508564165 (5.1 GiB)  TX bytes:613248 (598.8 KiB)
          Interrupt:25 Memory:e8000000-e8012800
  lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2163 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2163 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3604424 (3.4 MiB)  TX bytes:3604424 (3.4 MiB)
  ++++++++++++++++++++++++++++++++++++++++++
  
  [iyunv@localhost bonding]# dmesg | grep bond0
Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-bond0 instead
bonding: bond0: setting mode to balance-rr (0).
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: unable to remove non-existent slave em1 for bond bond0.
bonding: unable to remove non-existent slave em2 for bond bond0.
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: bond0: Adding slave em1.
bonding: bond0: Warning: failed to get speed and duplex from em1, assumed to be 100Mb/sec and Full.
bonding: bond0: enslaving em1 as an active interface with an up link.
ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
bonding: bond0: Adding slave em2.
bonding: bond0: Warning: failed to get speed and duplex from em2, assumed to be 100Mb/sec and Full.
bonding: bond0: enslaving em2 as an active interface with an up link.
bond0: no IPv6 routers present
bonding: bond0: Removing slave em1
bonding: bond0: Warning: the permanent HWaddr of em1 - 14:fe:b5:c8:1a:b7 - is still in use by bond0. Set the HWaddr of em1 to a different address to avoid conflicts.
bonding: bond0: releasing active interface em1
bonding: bond0: Removing slave em2
bonding: bond0: releasing active interface em2
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: unable to remove non-existent slave em1 for bond bond0.
bonding: unable to remove non-existent slave em2 for bond bond0.
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: bond0: Adding slave em1.
bonding: bond0: Warning: failed to get speed and duplex from em1, assumed to be 100Mb/sec and Full.
bonding: bond0: enslaving em1 as an active interface with an up link.
ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
bonding: bond0: Adding slave em2.
bonding: bond0: Warning: failed to get speed and duplex from em2, assumed to be 100Mb/sec and Full.
bonding: bond0: enslaving em2 as an active interface with an up link.
bond0: no IPv6 routers present
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  [iyunv@localhost bonding]# ethtool em1
Settings for em1:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
                        100baseT/Half 100baseT/Full
                        1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
                        100baseT/Half 100baseT/Full
                        1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: d
Link detected: yes
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  [iyunv@localhost bonding]# ethtool em2
Settings for em2:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
                        100baseT/Half 100baseT/Full
                        1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
                        100baseT/Half 100baseT/Full
                        1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: d
Link detected: yes
  +++++++++++++++++++++++++++++++++++++++++++++++
  [iyunv@localhost bonding]# ethtool bond0
Settings for bond0:
Link detected: yes
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-70059-1-1.html 上篇帖子: 采用Cisco 2600系列替换Cisco 2500系列 下篇帖子: Cisco Signs MOU with Shenzhen Municipal People's Government
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表