On Thu, Jul 18, 2024 at 8:33 PM <s...@swampdog.co.uk> wrote:
>
> On Wednesday, 17 July 2024 21:31:00 BST Jeffrey Walton wrote:
> > On Tue, Jul 16, 2024 at 1:35 PM jeremy ardley <jeremy.ard...@gmail.com>
> wrote:
> > > On 16/7/24 19:31, Tom Browder wrote:
> > > > [...]
> > > There are alternatives that include:
> > >
> > > - KVM/QEMU
> > >
> > > - VMWare Workstation Pro (which is now free for private use)
> > >
> > > In my experience KVM/QEMU is fairly stable. The VMWare product not so
> > > much.
> > >
> > > Given everything is virtual you can easily try all options in an hour or
> > > two.
> >
> > Add a "mee too" for KVM/QEMU/libvirt. The components are managed by
> > the kernel, so there are usually no technical problems, like unsigned
> > modules. Virt Manager takes a little getting used to, but everything
> > you need is there.
> >
> > The only downside to KVM/QEMU/libvirt is networking in some cases.
> > Configuring a VM to use your local DHCP server is a pain because you
> > have to setup and configure the bridging yourself. And the
> > documentation to do it does not exist.
>
> Out of interest, how is one supposed to do it now? I set mine up ages ago via
> /etc/network/interfaces - eg..
>
> auto br0
> iface br0 inet dhcp
>         bridge_ports    enp4s0
>         bridge_stp      off
>         bridge_fd       0
>         bridge_maxwait  0
>
> ..but I have no idea how to do it now. Manpage says 'brctl' is obsolete and
> points to 'bridge' which I've never used.

Yeah, I have an old server that was setup using the old commands, like
brctl. It has been so long I don't recall the steps I used to
configure it.

For a modern install on Debian with Systemd and Network Manager (and
not systemd-network), here are the rough steps I follow.

1. Ignore anything from `sudo -E virsh net-edit default`. You don't
use the default NAT. You use virbr0 instead.

2. Install nmtui.

3. `sudo nmtui`, then 'Edit a connection." Select bridge virbr0.

    * Under slaves, add Ethernet Connection 1. Check Automatically
Connect and Available to All Users.

    * Under IPv4, select Automatic. Remove addresses and friends.

    * Under IPv6, select Disabled. I don't run IPv6 internally.

4. Reboot the machine.

5. After reboot and login, you should see ethernet UP, vbridge UP, and
the host has a DHCP address via the bridge.

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
group default qlen 1000
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s20f0u3c2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel mast
er virbr0 state UP mode DEFAULT group default qlen 1000
   link/ether 20:7b:d2:8c:55:d4 brd ff:ff:ff:ff:ff:ff
3: wlo1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN m
ode DORMANT group default qlen 1000
   link/ether 9a:28:0e:bd:f4:ee brd ff:ff:ff:ff:ff:ff permaddr 00:41:0e:67:0e:7
b
   altname wlp87s0
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mod
e DEFAULT group default qlen 1000
   link/ether 20:7b:d2:8c:55:d4 brd ff:ff:ff:ff:ff:ff

And:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t 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: enp0s20f0u3c2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel mast
er virbr0 state UP group default qlen 1000
   link/ether 20:7b:d2:8c:55:d4 brd ff:ff:ff:ff:ff:ff
3: wlo1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN g
roup default qlen 1000
   link/ether 9e:8e:8a:6f:35:5e brd ff:ff:ff:ff:ff:ff permaddr 00:41:0e:67:0e:7
b
   altname wlp87s0
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP gro
up default qlen 1000
   link/ether 20:7b:d2:8c:55:d4 brd ff:ff:ff:ff:ff:ff
   inet 172.16.2.15/12 brd 172.31.255.255 scope global dynamic noprefixroute vi
rbr0
      valid_lft 6293sec preferred_lft 6293sec

6. In Virtual Machine Manager, select a VM, select NIC, choose Bridge
device... and select virbr0.

7. Start the VM. The VM will get an IP address from your local DHCP server.

You might find these commands useful if you don't (yet) have a bridge:
<https://wiki.archlinux.org/title/Network_bridge> and maybe this
discussion: <https://bbs.archlinux.org/viewtopic.php?id=253232>.

Jeff

Reply via email to