NetworkManager
NetworkManager¶
Let's put here some snippets that can be used to eventually modify some configurations on already installed CentOS Linux boxes
Bridge with ip address¶
bridge_name="br0"
bridge_dev="enp2s0f0"
ip="192.168.1.10/24"
gw="192.168.1.254"
dns="192.168.1.1,192.168.1.2"
nmcli con add con-name ${bridge_name} type bridge ifname ${bridge_name}
nmcli con mod ${bridge_name} ipv4.method manual ipv4.addr ${ip} ipv4.dns ${dns} ipv4.gateway ${gw} bridge.stp no
nmcli con del ${bridge_dev} ; nmcli con add con-name ${bridge_dev} type bridge-slave ifname ${bridge_dev} master ${bridge_name} ; nmcli con up ${bridge_dev} ; nmcli con up ${bridge_name} ; echo "sleeping" ; sleep 60 ; systemctl reboot
Bridge without IP address (virt hypervisor on another dedicated nic)¶
bridge_name="br_203"
bridge_dev="eth1"
nmcli con add con-name ${bridge_name} type bridge ifname ${bridge_name}
nmcli con mod ${bridge_name} ipv6.method ignore ipv4.method disabled
nmcli con del ${bridge_dev} ; nmcli con add con-name ${bridge_dev} type bridge-slave ifname ${bridge_dev} master ${bridge_name} ; nmcli con up ${bridge_dev} ; nmcli con up ${bridge_name}
VLAN interface 802.1q¶
eth_dev="eth0"
vlan_id="203"
ip="172.19.0.17/23"
gw=""
dns="172.22.0.1,172.22.0.2"
nmcli con add con-name ${eth_dev}.${vlan_id} type vlan dev ${eth_dev} id ${vlan_id} ipv4.method manual ipv4.address ${ip}
Bridge + VLAN tagging¶
eth_dev="enP5p5s0f3"
vlan_id="203"
nmcli con add type bridge ifname br_${vlan_id} ipv4.method disabled ipv6.method ignore bridge.stp no
nmcli connection add type vlan ifname ${eth_dev}.${vlan_id} dev ${eth_dev} id ${vlan_id} master br_${vlan_id} slave-type bridge