Made bridge .conf and set its permissions.
I have /usr/libexec/qemu-bridge-helper… set its permissions
nevj is in libvirt and kvm groups.
I made a script of your ip instructions
#!/usr/bin/bash
# Create the bridge
# first argument is bridge name ( eg br0 )
# second argument is interface name to link bridge to ( eg enp17s0)
ip link add name $1 type bridge
# Optional-disable STP and forwarding delay -good for simple setup
ip link set $1 type bridge stp_state 0 forward_delay 0
# Bring the bridge up
ip link set $1 up
# Remove any existing IP from the physical interface (critical)
ip addr flush dev $2
# Enslave the physical interface to the bridge
ip link set $2 master $1
# Bring the physical interface up
ip link set $2 up
# Request DHCP lease on the bridge
#dhclient $1
#dhcpcd $1
# NB add 'allow br0' to /etc/qemu/bridge.conf
the dhclient ( or dhcpcd) is commented out because I have a static interface.
After running the script
# sh -ex makebridge br0 enp17s0
+ ip link add name br0 type bridge
+ ip link set br0 type bridge stp_state 0 forward_delay 0
+ ip link set br0 up
+ ip addr flush dev enp17s0
+ ip link set enp17s0 master br0
+ ip link set enp17s0 up
# ip a
3: enp17s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether c8:60:00:cb:0b:6c brd ff:ff:ff:ff:ff:ff
14: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether c8:60:00:cb:0b:6c brd ff:ff:ff:ff:ff:ff
inet6 fe80::282b:8cff:fee8:41a7/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
Neither epp17s0 nor br0 have an IP address.
So I defined a static address
# Now give br0 a static address
# ip addr add 192.168.32.6/24 dev br0
# ip a
3: enp17s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether c8:60:00:cb:0b:6c brd ff:ff:ff:ff:ff:ff
14: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether c8:60:00:cb:0b:6c brd ff:ff:ff:ff:ff:ff
inet 192.168.32.6/24 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::282b:8cff:fee8:41a7/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
So now br0 has a static address … I used the same address that enp17s0 originally had.
Now start a VM… it is Alpine
Its eth0 does not have an IP address … it tries to get one by dhcp and fails.
So give etho an ip address and a default route
ip addr add 192.168.32.6/24 dev eth0
ip route add default via 192.168.32.6 dev eth0
Now from within the VM I can ping 192.168.32.6, 192.168.32.7 ( another computer on the 192.168.32.0 network) and 192.168.32.98 ( a network printer). I cant ping 192.168.0.57 ( the other ethernet card on the host) ?
And from the host I can ping 192.168.32.6( the VM) , 192.168.32.7 ( the other computer , Mary) , and 192.168.32.98 ( the network printer)
And from the other computer (Mary, 192.168.32.7) I can ping 192.168.32.6, 192.168.32.98, 192.168.0.57
So I bit the bullet and ssh’d from Mary into the VM. It works.
I deliberately linked br0 to the static local net because I want ed to see if the other computer on the local net could communicate with the VM… it can
I suspect there is a routing issue with the VM not pinging the hosts eno1 interface , which is dhcp and connects to the modem and is controlled by NetworkManager.
It works when I use the default NAT connection in virtmanager.
What would happen if I linked the bridge to eno1? I would then use dhcp. I would probably have to use @daniel.m.tripp 's NetworkManager setup, instead of ip, to define br0.
I find the whole business rather weird. There must be an easier way
I dont understand why a bridge effectively disables the interface it is linked to. I dont understand how virt-manager attaches itself to the bridge. I dont understand why I cant just put a VM on the local net like any other computer.
Thanks to @JoelA and @daniel.m.tripp . I never would have got there alone.
Three things are strange in that topology diagram
- it calls 192.168.32.6 trinity… trinity is the host not the VM?
- it can see Mary ( computer on local net) but it does not see a VM on the same neyt? It only sees the interface to it in the host.
- it says there is access to 192.168.0.57 via localhost ( the host) but pings from 192.168.32.6 dont get there?
Afterthought:
I think I should have used a different IP number within the VM.
ie leave br0 as 192.168.32.6 and set eth0 in VM to eg 192.168.32.8