Blame docs/tips/networkmanager.md

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