Linux BOND接口配置

如下使用ip命令创建一个bond接口不指定参数:

/ # ip link add bond1 type bond

指定bond接口的mode:
/ # ip link add bond2 type bond mode balance-xor


查看新创建的bond接口,bond1未指定mode,其默认为balance-rr模式:

/ # ip -detail link show type bond
24: bond1: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 8a:88:46:0f:8c:61 brd ff:ff:ff:ff:ff:ff promiscuity 0
    bond mode balance-rr miimon 0 updelay 0 downdelay 0 use_carrier 1 arp_interval 0 arp_validate none arp_all_targets any primary_reselect always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1 num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1 packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 1 addrgenmode eui64 numtxqueues 16 numrxqueues 16
25: bond2: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0e:9d:3f:06:8c:7e brd ff:ff:ff:ff:ff:ff promiscuity 0
    bond mode balance-xor miimon 0 updelay 0 downdelay 0 use_carrier 1 arp_interval 0 arp_validate none arp_all_targets any primary_reselect always fail_over_mac none xmit_hash_policy layer2 resend_igmp 1 num_grat_arp 1 all_slaves_active 0 min_links 0 lp_interval 1 packets_per_slave 1 lacp_rate slow ad_select stable tlb_dynamic_lb 1 addrgenmode eui64 numtxqueues 16 numrxqueues 16


为bond接口添加子接口,当所要添加的子接口为up状态时,不允许添加:


/ # ip link set eth0 master bond2
[   76.981976] bond2: eth0 is up - this may be due to an out of date ifenslave
RTNETLINK answers: Operation not permitted
/ #


/ # ifconfig eth0 down
/ # ip link set eth0 master bond2

查看添加的子接口,其master为bond2:

/ # ip link show type bond_slave

6: eth0: <BROADCAST,MULTICAST,PROMISC,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond2 state UP mode DEFAULT group default qlen 1000
    link/ether 00:90:27:fe:d0:5c brd ff:ff:ff:ff:ff:ff
/ #


移除eth0,重新up:

/ # ip link set eth0 nomaster
/ # ifconfig eth0 up


创建bond接口的完整参数列表可通过命令ip link help bond查看。

/ # ip link help bond
Usage: ... bond [ mode BONDMODE ] [ active_slave SLAVE_DEV ]
                [ clear_active_slave ] [ miimon MIIMON ]
                [ updelay UPDELAY ] [ downdelay DOWNDELAY ]
                [ use_carrier USE_CARRIER ]
                [ arp_interval ARP_INTERVAL ]
                [ arp_validate ARP_VALIDATE ]
                [ arp_all_targets ARP_ALL_TARGETS ]
                [ arp_ip_target [ ARP_IP_TARGET, ... ] ]
                [ primary SLAVE_DEV ]
                [ primary_reselect PRIMARY_RESELECT ]
                [ fail_over_mac FAIL_OVER_MAC ]
                [ xmit_hash_policy XMIT_HASH_POLICY ]
                [ resend_igmp RESEND_IGMP ]
                [ num_grat_arp|num_unsol_na NUM_GRAT_ARP|NUM_UNSOL_NA ]
                [ all_slaves_active ALL_SLAVES_ACTIVE ]
                [ min_links MIN_LINKS ]
                [ lp_interval LP_INTERVAL ]
                [ packets_per_slave PACKETS_PER_SLAVE ]
                 [ tlb_dynamic_lb TLB_DYNAMIC_LB ]
                [ lacp_rate LACP_RATE ]
                [ ad_select AD_SELECT ]
                [ ad_user_port_key PORTKEY ]
                [ ad_actor_sys_prio SYSPRIO ]
                [ ad_actor_system LLADDR ]

BONDMODE := balance-rr|active-backup|balance-xor|broadcast|802.3ad|balance-tlb|balance-alb
ARP_VALIDATE := none|active|backup|all
ARP_ALL_TARGETS := any|all
PRIMARY_RESELECT := always|better|failure
FAIL_OVER_MAC := none|active|follow
XMIT_HASH_POLICY := layer2|layer2+3|layer3+4|encap2+3|encap3+4
LACP_RATE := slow|fast
AD_SELECT := stable|bandwidth|count
/ #

猜你喜欢

转载自blog.csdn.net/sinat_20184565/article/details/81318503