Here is a short post on creating a bridge interface using the nmcli command in CentOS/RHEL 7 and 8 systems.
1. Get a list of the system’s active network connections:
# nmcli conn show --active
2. Next, create a network bridge by typing:
# nmcli conn add type bridge con-name br0 ifname br0
3. Next, set a static IPv4 address for the bridge network:
# nmcli conn mod br0 ipv4.address '192.168.xxx.yy/27' # nmcli conn mod br0 ipv4.gateway '192.168.xxx.1' # nmcli conn mod br0 ipv4.method manual
4. Now, add the ethernet interface, ens3, to the bridge, br0, connection:
# nmcli conn add type ethernet slave-type bridge con-name bridge-br0 ifname ens3 master br0
5. Activate the bridge connection:
# nmcli conn up br0
6. Deactivate the ethernet interface, ens3:
# nmcli conn down ens3
7. Get a list of the active network connections:
# nmcli conn show --active
8. Display the current bridge port configuration and flags:
# bridge link show
9. Display the new network bridge interface:
# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000 link/ether 52:12:34:56:78:5d brd ff:ff:ff:ff:ff:ff 4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 52:12:34:56:78:5d brd ff:ff:ff:ff:ff:ff inet 192.168.xxx.yy/27 brd 192.168.122.31 scope global noprefixroute br0 valid_lft forever preferred_lft forever
Note: The primary interface name in this example is ens3. The commands above should be run at the console if you are switching the Primary NIC to a bridge interface. The “ip addr” command shows the static IPv4 network address assigned has transitioned from the primary NIC, ens3, to the bridge, br0.