RedHat networking

From Lolly's Wiki
Revision as of 16:52, 25 November 2021 by Lollypop (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")
Jump to navigationJump to search

Bonding

In this example we configure two bonds.

bond0 : Failover (eno1/bond0_slave1 and eno3/bond0_slave2) bond1 : LACP

/etc/modprobe.d/bonding.conf

<syntaxhighlight lang=conf> alias netdev-bond0 bonding options bond0 miimon=100 mode=active-backup updelay=0 downdelay=0 primary=bond0_slave1

alias netdev-bond1 bonding options bond1 miimon=100 mode=4 lacp_rate=1 </source>

/etc/sysconfig/network-scripts/ifcfg-bond0

<syntaxhighlight lang=conf> DEVICE=bond0 TYPE=Bond BONDING_MASTER=yes BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=bond0 UUID=9e2088b8-4cfe-435a-b0a2-9387f0fc8024 ONBOOT=yes DNS1=172.16.0.69 BONDING_OPTS="miimon=100 updelay=0 downdelay=0 mode=active-backup primary=bond0_slave1" IPADDR=172.16.0.105 PREFIX=16 GATEWAY=172.16.0.1 </source>

/etc/sysconfig/network-scripts/ifcfg-bond0_slave1

<syntaxhighlight lang=conf> HWADDR=94:18:82:80:C2:18 TYPE=Ethernet NAME=bond0_slave1 UUID=a03819df-0715-455d-9726-9348cdbd45c9 DEVICE=eno1 ONBOOT=yes MASTER=bond0 SLAVE=yes </source>

/etc/sysconfig/network-scripts/ifcfg-bond0_slave2

<syntaxhighlight lang=conf> HWADDR=94:18:82:80:C2:1A TYPE=Ethernet NAME=bond0_slave2 UUID=a03819df-0715-455d-9726-9348cdbd45c9 DEVICE=eno3 ONBOOT=yes MASTER=bond0 SLAVE=yes </source>

Check state of bond0

<syntaxhighlight lang=bash>

  1. cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eno1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0

Slave Interface: eno1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 94:18:82:80:c2:18 Slave queue ID: 0

Slave Interface: eno3 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 94:18:82:80:c2:1a Slave queue ID: 0 </source>

/etc/sysconfig/network-scripts/ifcfg-bond1

<syntaxhighlight lang=conf> DEVICE=bond1 TYPE=Bond BONDING_MASTER=yes BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=bond1 UUID=c9a4bce2-5dbe-4cf9-beb6-34a24512ae23 ONBOOT=yes BONDING_OPTS="mode=4 miimon=100 lacp_rate=1" IPADDR=172.20.0.30 PREFIX=24 </source>

/etc/sysconfig/network-scripts/ifcfg-bond1_slave1

<syntaxhighlight lang=conf> TYPE=Ethernet NAME=bond1_slave1 UUID=9ad3a93f-362e-4a18-bb2e-c4588e666e12 ONBOOT=yes MASTER=bond1 SLAVE=yes MACADDR=14:02:ec:8e:f3:24 MTU=1500 DEVICE=eno49 </source>

/etc/sysconfig/network-scripts/ifcfg-bond1_slave2

<syntaxhighlight lang=conf> TYPE=Ethernet NAME=bond1_slave2 UUID=6d8015ef-fe60-472a-b18f-17caf952e45b ONBOOT=yes MASTER=bond1 SLAVE=yes MACADDR=14:02:ec:8e:f3:24 MTU=1500 DEVICE=eno50 </source>

Check state of bond1

<syntaxhighlight lang=bash>

  1. cat /proc/net/bonding/bond1

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer2 (0) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0

802.3ad info LACP rate: fast Min links: 0 Aggregator selection policy (ad_select): stable Active Aggregator Info: Aggregator ID: 2 Number of ports: 2 Actor Key: 13 Partner Key: 70 Partner Mac Address: 01:e0:52:00:00:02

Slave Interface: eno49 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 14:02:ec:8e:f3:24 Slave queue ID: 0 Aggregator ID: 2 Actor Churn State: none Partner Churn State: none Actor Churned Count: 0 Partner Churned Count: 0 details actor lacp pdu:

   system priority: 0
   port key: 13
   port priority: 255
   port number: 1
   port state: 63

details partner lacp pdu:

   system priority: 32768
   oper key: 70
   port priority: 32768
   port number: 534
   port state: 63

Slave Interface: eno50 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 14:02:ec:8e:f3:24 Slave queue ID: 0 Aggregator ID: 2 Actor Churn State: none Partner Churn State: none Actor Churned Count: 0 Partner Churned Count: 0 details actor lacp pdu:

   system priority: 0
   port key: 13
   port priority: 255
   port number: 2
   port state: 63

details partner lacp pdu:

   system priority: 32768
   oper key: 70
   port priority: 32768
   port number: 1046
   port state: 63

</source>