Discussion:
Debian 11 and IPv4 static IP address
(too old to reply)
David Christensen
2024-07-05 02:10:01 UTC
Permalink
debian-user:

I have built a VirtualBox virtual machine and installed Debian 11 with
SSH server and standard system utilities only. I plan to use the VM to
run the UniFi Network Controller to manage the UniFi equipment on my
SOHO LAN:

***@unifi:~# cat /etc/debian_version ; uname -a
11.10
Linux unifi 5.10.0-30-amd64 #1 SMP Debian 5.10.218-1 (2024-06-01) x86_64
GNU/Linux


The VM currently has a DHCP address. I would like to set a static IPv4
address. The Debian wiki tells me to edit /etc/network/interfaces and
provides some example settings that I believe I can adapt to my use-case:

https://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_manually

auto eth0
iface eth0 inet static
address 192.0.2.7/24
gateway 192.0.2.254


The Debian wiki also says:

"Make sure to disable all DHCP services, e.g. dhcpcd."


What is the correct method to "disable all DHCP services"?


David
Felix Miata
2024-07-05 02:40:01 UTC
Permalink
Post by David Christensen
I have built a VirtualBox virtual machine and installed Debian 11 with
SSH server and standard system utilities only. I plan to use the VM to
run the UniFi Network Controller to manage the UniFi equipment on my
11.10
Linux unifi 5.10.0-30-amd64 #1 SMP Debian 5.10.218-1 (2024-06-01) x86_64
GNU/Linux
The VM currently has a DHCP address. I would like to set a static IPv4
address. The Debian wiki tells me to edit /etc/network/interfaces and
https://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_manually
auto eth0
iface eth0 inet static
address 192.0.2.7/24
gateway 192.0.2.254
"Make sure to disable all DHCP services, e.g. dhcpcd."
What is the correct method to "disable all DHCP services"?
I think there are more than one. One thing is to check what is enabled, then
disable or uninstall whatever owns the unit(s):

systemctl list-unit-files | egrep 'net|dhcp'

Do the same with whatever "manages" /etc/resolv.conf, and create a regular file of
your own design.

I don't use VMs, but I did several hours ago instruct several hours ago using
systemd-network to setup static IP service for a *buntu user who couldn't get
netplan sorted:
<https://www.linuxquestions.org/questions/ubuntu-63/netplan-apply-no-longer-setting-static-ip-address-4175738702/#post6512274>

I've been using systemd-network static IPs on everything for several years,
including Bullseye.
--
Evolution as taught in public schools is, like religion,
based on faith, not based on science.

Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata
David Christensen
2024-07-05 03:40:01 UTC
Permalink
Post by Felix Miata
Post by David Christensen
I have built a VirtualBox virtual machine and installed Debian 11 with
SSH server and standard system utilities only. I plan to use the VM to
run the UniFi Network Controller to manage the UniFi equipment on my
<snip>
The VM currently has a DHCP address. I would like to set a static IPv4
address. The Debian wiki tells me to edit /etc/network/interfaces and
<snip>
"Make sure to disable all DHCP services, e.g. dhcpcd."
What is the correct method to "disable all DHCP services"?
I think there are more than one. One thing is to check what is enabled, then
systemctl list-unit-files | egrep 'net|dhcp'
2024-07-04 20:26:35 ***@unifi ~
# systemctl list-unit-files | egrep 'net|dhcp'
networking.service enabled enabled
systemd-network-generator.service disabled disabled
systemd-networkd-wait-online.service disabled disabled
systemd-networkd.service disabled enabled
systemd-networkd.socket disabled enabled
network-online.target static -
network-pre.target static -
network.target static -
Post by Felix Miata
Do the same with whatever "manages" /etc/resolv.conf,
How do I determine what manages /etc/resolv.conf?
Post by Felix Miata
and create a regular file of your own design.
I don't use VMs, but I did several hours ago instruct several hours ago using
systemd-network to setup static IP service for a *buntu user who couldn't get
<https://www.linuxquestions.org/questions/ubuntu-63/netplan-apply-no-longer-setting-static-ip-address-4175738702/#post6512274>
I've been using systemd-network static IPs on everything for several years,
including Bullseye.
2024-07-04 20:15:43 ***@laalaa ~
# man systemd-network
No manual entry for systemd-network


How do you use systemd-network to configure an interface with a static
IP address?


David
Felix Miata
2024-07-05 04:10:01 UTC
Permalink
Post by David Christensen
Post by Felix Miata
Post by David Christensen
I have built a VirtualBox virtual machine and installed Debian 11 with
SSH server and standard system utilities only. I plan to use the VM to
run the UniFi Network Controller to manage the UniFi equipment on my
<snip>
The VM currently has a DHCP address. I would like to set a static IPv4
address. The Debian wiki tells me to edit /etc/network/interfaces and
<snip>
"Make sure to disable all DHCP services, e.g. dhcpcd."
What is the correct method to "disable all DHCP services"?
I think there are more than one. One thing is to check what is enabled, then
systemctl list-unit-files | egrep 'net|dhcp'
# systemctl list-unit-files | egrep 'net|dhcp'
networking.service enabled enabled
systemd-network-generator.service disabled disabled
systemd-networkd-wait-online.service disabled disabled
systemd-networkd.service disabled enabled
systemd-networkd.socket disabled enabled
network-online.target static -
network-pre.target static -
network.target static -
Usually the only unit among the above I need enabled is systemd-networkd.socket.
Post by David Christensen
Post by Felix Miata
Do the same with whatever "manages" /etc/resolv.conf,
How do I determine what manages /etc/resolv.conf?
I expect whatever /etc/resolv.conf symlinks to could be the clue you need, if you
can't grep some "solv" from list-unit-files output, and if it's not just a symlink
to something in the /run/ tree. /etc/resolv.d/ might be another place to look.
I've been using systemd-network so long I don't remember the hodgepodge of old
ways to "manage" this file that normally needs no management with static IP usage.
NetworkMangler is probably one candidate not installed here. Could be part of what
networking.service does too. It's also not available here. Packages named
knot-resolver, resolvconf and systemd-resolved exist, perhaps others.
Post by David Christensen
Post by Felix Miata
and create a regular file of your own design.
I don't use VMs, but I did several hours ago instruct several hours ago using
systemd-network to setup static IP service for a *buntu user who couldn't get
<https://www.linuxquestions.org/questions/ubuntu-63/netplan-apply-no-longer-setting-static-ip-address-4175738702/#post6512274>
I've been using systemd-network static IPs on everything for several years,
including Bullseye.
# man systemd-network
No manual entry for systemd-network
systemd-network is the package name in newer versions of systemd. That URL shows
the relevant systemd unit names are systemd-networkd.*. man systemd-networkd works
here in the newer releases I have booted.
Post by David Christensen
How do you use systemd-network to configure an interface with a static
IP address?
That URL shows how I did it, a file in /etc/systemd/network/ with the vitals,
similar to more traditional NIC setup files.
--
Evolution as taught in public schools is, like religion,
based on faith, not based on science.

Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata
David Christensen
2024-07-06 01:20:01 UTC
Permalink
On 7/4/24 21:08, Felix Miata wrote:
<snip>

On 7/4/24 21:10, jeremy ardley wrote:
<snip>

On 7/5/24 11:44, Franco Martelli wrote:
<snip>


Thank you all for the replies.


I can find no statement in The Debian Administrator's Handbook regarding
disabling DHCP when using a static IP:

https://www.debian.org/doc/manuals/debian-handbook/sect.network-config.en.html#sect.interface-ethernet


Similarly, when STFW "Debian 11 static IP" and reading articles.


Browsing the Debian Wiki page "NetworkConfiguration" -> "Info" link:

https://wiki.debian.org/NetworkConfiguration?action=info

The following sentence:

"Make sure to disable all DHCP services, e.g. dhcpcd."

Was added at revision 97:

97 2017-12-27 10:50:07 25741 to previous ?mrsgreen note for static
ip's: disable dhcp services view


Who is "mrsgreen"?


David
Max Nikulin
2024-07-06 02:10:01 UTC
Permalink
Post by David Christensen
I can find no statement in The Debian Administrator's Handbook regarding
[...]
Post by David Christensen
https://wiki.debian.org/NetworkConfiguration?action=info
"Make sure to disable all DHCP services, e.g. dhcpcd."
From my point of view this warning makes sense. Primary it is a
troubleshooting step if an attempt to configure static has IP failed.
The assumption is that a reader is either aware what network management
tools are installed on their machine or is able to review installed
packages, active services, running processes. DHCP client activity may
appear in logs.

If you have achieved you goal then just skip this step.

A side note: I would consider running dnsmasq on the host configured
specifically as a DHCP server and a caching DNS server for virtual
machines and ignoring other network interfaces.
David Christensen
2024-07-06 05:00:01 UTC
Permalink
On 7/5/24 19:06, Max Nikulin wrote:
<snip>

On 7/5/24 21:14, George at Clug wrote:
<snip>


Thank you for your replies.


The underlying issue appears to be that my old-school Linux console
network administration skills have been rendered obsolete by systemd and
NetworkManager. I typically install Xfce when installing Debian, and
the panel NetworkManager Applet has made it too easy to "monkey see,
monkey do" without understanding the details.


What I really need is a good book or document that explains the design
and implementation of networking with systemd and Network Manager on
modern Debian GNU/Linux systems. Recommendations?


David
jeremy ardley
2024-07-06 07:30:01 UTC
Permalink
Post by David Christensen
What I really need is a good book or document that explains the design
and implementation of networking with systemd and Network Manager on
modern Debian GNU/Linux systems.  Recommendations?
If you want to persist with the NetworkManager approach, this tutorial
to configure it nmtui is good.

NetworkManager supports static IP addresses and you can configure them
in nmtui.

https://www.tecmint.com/nmtui-configure-network-connection/

Remember if you use NetworkManager you have to remove your static
entries in /etc/network/interfaces file and/or in files in
/etc/network.interfaces.d


The long term best choice is to convert to using systemd-networkd which
is highly configurable and much more reliable than NetworkManager
Detlef Vollmann
2024-07-06 10:50:01 UTC
Permalink
Post by David Christensen
The underlying issue appears to be that my old-school Linux console
network administration skills have been rendered obsolete by systemd and
NetworkManager.
I don't think that these skills are obsolete.
I still use /etc/network/interfaces for everything special
(and use the NetworkManager applet on my laptop to manage
wifi networks.

The only thing that's always annoying is that too many programs
believe they have to overwrite /etc/resolv.conf...

Detlef
Marc SCHAEFER
2024-07-06 15:20:01 UTC
Permalink
Hello,
Post by Detlef Vollmann
The only thing that's always annoying is that too many programs
believe they have to overwrite /etc/resolv.conf...
chattr +i # immutable
still works :)

Greg Wooledge
2024-07-06 14:10:02 UTC
Permalink
What I really need is a good book or document that explains the design and
implementation of networking with systemd and Network Manager on modern
Debian GNU/Linux systems. Recommendations?
The main thing to understand is that there IS NOT a single unified
way of doing network configuration in Debian. Instead, there are
many choices.

So, the first thing you have to discover on your system is which
choices are in play. Once you know which things to investigate and
poke, then you can learn how those particular things work, by reading
the documentation that's specific to those things.

So, let's start at the interface level. Interfaces are named by the
kernel, when you boot. The kernel performs hardware probes, to discover
the network interfaces, both ethernet and wireless. The kernel
assigns TEMPORARY NAMES to each interface it finds, in the order in
which its probes happen to find them. These temporary names look like
"eth0", "eth1" and so on for ethernet interfaces, and "wlan0", "wlan1"
and so on for wireless.

If you've told your kernel NOT to perform the second step, then these
semi-randomly assigned temporary names become the permanent names of
your interfaces. Otherwise, the kernel performs some gymnastics to
try to assign "predictable" names to each interface. An onboard
ethernet interface, for example, may be renamed to "eno1", or a PCI
ethernet interface may be renamed to something like "enp2s0" based
on the PCI slot.

Or, if you don't want the kernel to assign names, you may choose your
own names for your interfaces, by configuring systemd.link(5) files.

To learn what your interface names are, you can start with this
command:

ip link
From the output of that, you can deduce which naming scheme is being
used. You should be able to figure out which interfaces are ethernet
and which are wireless (hint: look at the first letter), and you might
be able to guess whether the names will remain stable over time, or
whether you should do something to switch naming schemes.

Once you have your interface names, there are three basic ways to
configure them:

1) /etc/network/interfaces a.k.a. /e/n/i a.k.a. ifupdown

2) NetworkManager

3) systemd.network(5)

Option 1 is the way Debian has always supported, for three decades.
See interfaces(5) for documentation of the main configuration file.

Option 2 is often installed by default if you install a Desktop
Environment package. In Debian, /e/n/i and NM will work together --
if an interface is configured in /e/n/i, NM will leave that interface
alone. There are three different ways to interact with NM -- a
set of command line tools (nmcli), a terminal-based interface (nmtui),
and a graphical interface (click things provided by your DE).

Option 3 is obviously part of systemd, and is not used in a default
Debian installation. However, you're free to use it if you wish.
Or, if someone else installed Debian for you, such as a VPS provider,
it's *possible* that they used this. Therefore, it's good to be
aware that it exists, and *might* be in play on your system, if you
weren't the one who installed Debian.

Once you figure out which option is being used, you can read the
documentation. I've provided man page references for the ones that
have them, and I've done my best to supply what little information I
have about NM.
Detlef Vollmann
2024-07-06 10:30:01 UTC
Permalink
Post by Max Nikulin
Post by David Christensen
"Make sure to disable all DHCP services, e.g. dhcpcd."
From my point of view this warning makes sense. Primary it is a
troubleshooting step if an attempt to configure static has IP failed.
The assumption is that a reader is either aware what network management
tools are installed on their machine or is able to review installed
packages, active services, running processes. DHCP client activity may
appear in logs.
I think this warning is very misleading: if an interface specification
in /etc/network/interfaces uses the 'static' method, no DHCP client
for this interface will be started.

On a laptop you may have the wifi with DHCP and wired network
with a static address.
Or on a workstation you may have the office LAN interface with DHCP
and a development LAN with a static IP address.
So disabling DHCP may cause additional problems and will solve none.

Detlef
George at Clug
2024-07-06 04:20:01 UTC
Permalink
David,

How are your efforts toward setting a static IP address going? Have you succeeded.

I set up a lot of test servers (for fun and no profit), and hence work with Hypervisors (KVM more than Virtual Box), and have some experience in this area. But at this point I am not sure if you need assistance or were just generally asking questions about the comment in the documentation about dhcpcd.

After checking my computers (VM and physical), I cannot find dhcpcd installed. Hence I guess the comment in the documentation was simply a reminder to anyone how may have been using that service, to ensure they disable it for their Static IP addressed interface?

If you have having any challenges getting your VM to access your "UniFi equipment", please let me know.

If the dhcpcd service was installed and running I presume:

# systemctl stop dhcpcd.service will stop (deactivate) dhcpcd
# systemctl disable dhcpcd.service will prevent it from restarting

George.

In my research before replying I found the following information which I found interesting. Thank you for raising your question.

# systemctl list-units --type=service | grep dhcp

https://wiki.debian.org/NetworkConfiguration
Make sure to disable all DHCP services, e.g. dhcpcd.

https://support.qacafe.com/cdrouter/knowledge-base/prevent-network-manager-from-controlling-an-interface/
The preferred way to tell Network Manager to stop controlling an interface is by creating/updating a file in the /etc/NetworkManager/conf.d/ directory and giving it the following content. You can name the file anything with a .conf suffix, but all files in that directory will be read in asciibetical order. Files read later override snippets of files read earlier. Make sure the keyfile plugin is listed. Other plugins may be listed too.

[main]
plugins=ifcfg-rh,keyfile

[keyfile]
unmanaged-devices=interface-name:eth0;interface-name:wifi1

The keyfile section can also include wildcards and exceptions as follows:

[keyfile]
unmanaged-devices=interface-name:eth*,except:interface-name:eth0,except:interface-name:eth3;interface-name:wifi*

Interfaces can also be defined by their MAC addresses (in lower case):

[keyfile]
unmanaged-devices=mac:00:11:22:33:44:55;mac:66:77:88:99:00:aa

Reboot for the changes to take effect.

https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface


Gnome:
sudo apt-get remove --purge network-manager-gnome network-manager network-manager-pptp network-manager-pptp-gnome
KDE:
sudo apt-get remove --purge knetworkmanager network-manager

https://wiki.debian.org/SystemdNetworkd
Post by David Christensen
<snip>
<snip>
<snip>
Thank you all for the replies.
I can find no statement in The Debian Administrator's Handbook regarding
https://www.debian.org/doc/manuals/debian-handbook/sect.network-config.en.html#sect.interface-ethernet
Similarly, when STFW "Debian 11 static IP" and reading articles.
https://wiki.debian.org/NetworkConfiguration?action=info
"Make sure to disable all DHCP services, e.g. dhcpcd."
97 2017-12-27 10:50:07 25741 to previous ?mrsgreen note for static
ip's: disable dhcp services view
Who is "mrsgreen"?
David
jeremy ardley
2024-07-06 04:40:01 UTC
Permalink
Post by David Christensen
I can find no statement in The Debian Administrator's Handbook regarding
https://www.debian.org/doc/manuals/debian-handbook/sect.network-config.en.html#sect.interface-ethernet
As I said in my earlier post, it's not necessary to disable dhcpd and in
fact it is likely undesirable.

In many lan networks there will some machines that get an address from a
dhcp server and some that have static IP - such as a server or a router.

In some cases machines will have static IP in addition to a dhcp
provided one.

Your best bet is, if it is working just fine, do nothing.

Though as a pointed out before, your machine very likely will have
NetworkManager running and it's probably a good idea to disable it.
Detlef Vollmann
2024-07-06 10:40:01 UTC
Permalink
Post by jeremy ardley
As I said in my earlier post, it's not necessary to disable dhcpd and in
fact it is likely undesirable.
Note that the warning in the wiki talks about dhcpcd, not about dhcpd.
Post by jeremy ardley
Though as a pointed out before, your machine very likely will have
NetworkManager running and it's probably a good idea to disable it.
NetworkManager reliably ignores all interfaces that have an entry
in /etc/network/interfaces.
If I setup my laptop as AP I have an entry for it in
/etc/network/interfaces, but let the NetworkManager handle the
wired network.

I don't know how well systemd-networkd cooperates with
/etc/network/interfaces.

Detlef
jeremy ardley
2024-07-05 05:20:01 UTC
Permalink
Post by Felix Miata
I think there are more than one. One thing is to check what is enabled, then
systemctl list-unit-files | egrep 'net|dhcp'
Do the same with whatever "manages" /etc/resolv.conf, and create a regular file of
your own design.
I don't use VMs, but I did several hours ago instruct several hours ago using
systemd-network to setup static IP service for a *buntu user who couldn't get
There seems to be some misunderstanding here.

dhcpd services for a vm are provided by the host running the vm.
Depending on the vm software e.g. KVM/QEMU or VMWare Workstation there
will be different mechanisms to configure or disable this service to the
vm client.

However it is not necessary if you configure the vm client using the
systemd networking client service - as the OP has done.

More relevant is explicitly disabling any competing network clients on
the vm that may affect things like DNS.

I recommend :

sudo systemctl disable NetworkManager.service
sudo systemctl stop NetworkManager.service
sudo systemctl mask NetworkManager.service

sudo systemctl disable systemd-networkd
sudo systemctl stop systemd-networkd
sudo systemctl mask systemd-networkd

I reiterate that if DNS resolution is needed it needs to be set in
/etc/hosts and/or in /etc/resolv.conf

(I also use systemd-networkd in preference to the other two types of
client networking)
jeremy ardley
2024-07-05 05:30:01 UTC
Permalink
Post by jeremy ardley
Post by Felix Miata
I think there are more than one. One thing is to check what is enabled, then
    systemctl list-unit-files | egrep 'net|dhcp'
Do the same with whatever "manages" /etc/resolv.conf, and create a regular file of
your own design.
I don't use VMs, but I did several hours ago instruct several hours ago using
systemd-network to setup static IP service for a *buntu user who couldn't get
There seems to be some misunderstanding here.
dhcpd services for a vm are provided by the host running the vm.
Depending on the vm software e.g. KVM/QEMU or VMWare Workstation there
will be different mechanisms to configure or disable this service to the
vm client.
However it is not necessary if you configure the vm client using the
systemd networking client service - as the OP has done.
More relevant is explicitly disabling any competing network clients on
the vm that may affect things like DNS.
sudo systemctl disable NetworkManager.service
sudo systemctl stop NetworkManager.service
sudo systemctl mask NetworkManager.service
sudo systemctl disable systemd-networkd
sudo systemctl stop systemd-networkd
sudo systemctl mask systemd-networkd
I reiterate that if DNS resolution is needed it needs to be set in
/etc/hosts and/or in /etc/resolv.conf
(I also use systemd-networkd in preference to the other two types of
client networking)
One further point is that the interface name seen by a client vm may not
be eth0 and could be one of many 'predictable' interface names e.g enp1s0

I guess I'm 'lucky' that I have set up literally hundreds of vms in the
past few months using linux and windows hosts and clients including
debian, fedora, centos, ubuntu, RHEL, windows server, windows
workstation, and hosting using VMWare Workstation, esxi hosts, KVM/QEMU

One obnoxious thing about most of the linuxes is the reliance on
NetworkManager which may be fine for a beginner in a simple scenario
such as a laptop but can be extremely unhelpful in many scenarios. (As
can be VMWare Workstation)
jeremy ardley
2024-07-05 04:20:01 UTC
Permalink
Post by David Christensen
"Make sure to disable all DHCP services, e.g. dhcpcd."
What is the correct method to "disable all DHCP services"?
The instruction is not necessary.

It doesn't matter if there is a dhcp server anywhere if the client -
your VM - doesn't use dhcp.

You appear to have the staza correct as are using static rather than dhcp.

No further action required.

However, beyond this you will probably need some dns services. This can
be in the form of entries in /etc/hosts file or you can specify a dns
server in /etc/resolv.conf
Franco Martelli
2024-07-05 18:50:01 UTC
Permalink
The VM currently has a DHCP address.  I would like to set a static IPv4
address.  The Debian wiki tells me to edit /etc/network/interfaces and
...
What is the correct method to "disable all DHCP services"?
You can also keep your virtual machine configured to request an IP
address from your DHCP server and configure the server to send the IP
address that you wish.

All you need to know it's the NIC's MAC address of your virtual machine,
then edit "/etc/dhcp/dhcpd.conf" and add a stanza like the following:

host unifi {
hardware ethernet 11:22:33:44:55:66;
fixed-address 192.0.2.7;
}

Cheers
--
Franco Martelli
George at Clug
2024-07-06 07:40:02 UTC
Permalink
Post by David Christensen
Thank you for your replies.
The underlying issue appears to be that my old-school Linux console
network administration skills have been rendered obsolete by systemd
and
Post by David Christensen
NetworkManager.  I typically install Xfce when installing Debian,
and
Post by David Christensen
the panel NetworkManager Applet has made it too easy to "monkey see,
monkey do" without understanding the details.
What I really need is a good book
Thanks for that question about books.
A 'book' ?  What is a 'book' ??
I recall mother reading from such things when I was a child.

(so hard to keep a straight face and not be laughing as I try to
pretend that 'books' are old school, but sadly it is not far from the
truth. My children know not the age before 'the Internet and Google
were how to find knowledge', the idea of going to a library to
research though 'books' seem so foreign to them. Soon asking an AI
system for the answer will be the way, and Google and Internet
searching, will be thought of as historic research techniques.)
Post by David Christensen
or document that explains the design
and implementation of networking with systemd and Network Manager on
modern Debian GNU/Linux systems.  Recommendations?
Sadly I have not found any documentation (or books) for any thing
Linux. It seems to be a 'piecing together of random statements' from
comments and howtos on the Internet, and much personal
experimentation.

The closest to any systematic learning method I have seen would be Red
Hat certifications. Not that I have even done any.

As far as general networking books, CISCO certification books have
been useful to me, but I am not a good reader, and they are lengthy.

For Internet doco, see pages like  
https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/configuring-virtual-machine-network-connections_configuring-and-managing-virtualization

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-a-network-bridge_configuring-and-managing-networking#configuring-a-network-bridge-using-nmcli-commands_configuring-a-network-bridge

https://www.ibm.com/docs/en/linux-on-systems?topic=choices-kvm-default-nat-based-networking

https://wiki.libvirt.org/page/Libvirtd_and_dnsmasq

https://wiki.libvirt.org/page/Networking
Post by David Christensen
David
If it helps, two things I have done is;

1) Set manual IP address in Network Manager so that it is managing the
networking on my behalf. Particularly if I use a GUI, of which my
favourite for VMs is XFCE as it is lightweight and works well with
spice (that is not a Dune reference, btw). Network Manager can even do
bridges, though I have had issues on initial power on.

2) I have had success, uninstalling Network Manager and then
configuring /etc/network/interfaces.

Below are two examples from my own 'play' test environments.  

Over time I have used bridging many times, so my VMs can be on the
same network as my other PCs, servers, etc. Bridges are not necessary
when all VMs are test VMs in their own private network running in the
same Hypervisor. Some times I have  set up a route from my PCs' own
network to the Hypervisor's provided network for its VMs.

/etc/hosts              

/etc/resolv.conf      (Generated by NetworkManager, if
installed)

/etc/network/interfaces

Examples for Static IP addresses.

# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet static
    address 192.168.100.101/24
    gateway 192.168.100.1
    # dns-* options are implemented by the resolvconf package, if
installed
    dns-nameservers 192.168.100.1
    dns-search tstenv.net


# cat /etc/resolv.conf
search tstenv.net
nameserver 192.168.100.1


$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug enp1s0
auto enp1s0
iface enp1s0 inet manual
iface enp1s0 inet6 manual

# bridge
auto brRed

iface brRed inet static
    address 192.168.100.103/24
    gateway 192.168.100.1
        network 192.168.100.0
        broadcast 192.168.100.255
        bridge_ports enp1s0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
    # dns-* options are implemented by the resolvconf package, if
installed
    dns-nameservers 192.168.100.1
    dns-search tstenv.net

# bridge allow auto conf for ipv6
iface brRed inet6 auto
        accept_ra 1
Michel Verdier
2024-07-06 15:00:01 UTC
Permalink
Post by George at Clug
Post by David Christensen
What I really need is a good book
or document that explains the design
and implementation of networking with systemd and Network Manager on
modern Debian GNU/Linux systems.  Recommendations?
Sadly I have not found any documentation (or books) for any thing
Linux. It seems to be a 'piecing together of random statements' from
comments and howtos on the Internet, and much personal
experimentation.
Of course uptodate informations are as you say dispatched on
internet. For systemd I would suggest:
https://wiki.archlinux.org/title/Systemd
For Network Manager:
https://wiki.debian.org/NetworkManager

Still some fundamentals could be learned more easily with a book. This
one is rather good:
https://debian-handbook.info/about-the-book/?ref=itsfoss.com
Loading...