Testing making a bridge to a NetworkManager controlled NIC.
Today I want to try a bridge linked to my DHCP interface that goes to the modem and is controlled by NeworkManager.
I used @daniel.m.tripp 's comands, set up as a script
#!/usr/bin/bash
# Create a bridge with NetworkManager
# first argument is bridge name ( eg br0 )
# second argument is NIC name to link bridge to ( eg eno1)
# third argument is the mac address of the NIC (eg c8:60:00:cb:0e:28)
# link bridge to the mac address of the NIC
nmcli con add type bridge ifname $1 stp no bridge.mac-address $3
# make the NIC a slave
nmcli con add type bridge-slave ifname $2 master $1
# Modify connection parameters
nmcli con mod bridge-$1 ipv4.method auto
# bring bridge up
nmcli con up bridge-$1
Here it is running
[nevj@trinity ~]$ sh -ex ./makebridge.nm br0 eno1 c8:60:00:cb:0e:28
+ nmcli con add type bridge ifname br0 stp no bridge.mac-address c8:60:00:cb:0e:28
Connection 'bridge-br0' (3b5b71fc-6b11-46e3-a633-249339e72aab) successfully added.
+ nmcli con add type bridge-slave ifname eno1 master br0
Connection 'bridge-slave-eno1' (f4245908-407b-4e78-9a24-efcc84378141) successfully added.
+ nmcli con mod bridge-br0 ipv4.method auto
+ nmcli con up bridge-br0
Connection successfully activated (controller waiting for ports) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
and it makes a br0
[nevj@trinity ~]$ ip a
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether c8:60:00:cb:0e:28 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.57/24 brd 192.168.0.255 scope global dynamic noprefixroute eno1
valid_lft 84309sec preferred_lft 84309sec
inet6 2001:8003:2c09:f600:f9fd:b4b4:32c3:b78f/64 scope global dynamic noprefixroute
valid_lft 59219sec preferred_lft 59219sec
inet6 fe80::fe69:873c:74e6:14b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
9: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether c8:60:00:cb:0e:28 brd ff:ff:ff:ff:ff:ff
but the interface br0 is down and has no IP address.
and the eno1 interface is UP and has an IP address.
That is different to what I did with a static IP interface.
I dont think that is going to work?
I dont see how I can reboot after running the script ( as @daniel.m.tripp recommended)… It will lose all the settings?
I tried bringing up an Alpine VM. The bridge does not work.
eth0 in alpine is UP but has no IP address… it should get one by DHCP.
I think somehow dhcp is not working for br0… because it has no IP address.
My modem connection is still working… ie eno1 is still functioning.
Afterthought:
I can see my mistake, I think… I gave my script the mac address of the eno1 NIC. I should have made up a new mac address for br0 and specified that as the third parameter.
My bridge links en01 to itself!!
Oh dear, networking is not my forte.

