Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #270846 > unrolled thread

Debian 11 and IPv4 static IP address

Started byDavid Christensen <dpchrist@holgerdanske.com>
First post2024-07-05 04:10 +0200
Last post2024-07-05 20:50 +0200
Articles 19 — 9 participants

Back to article view | Back to linux.debian.user


Contents

  Debian 11 and IPv4 static IP address David Christensen <dpchrist@holgerdanske.com> - 2024-07-05 04:10 +0200
    Re: Debian 11 and IPv4 static IP address Felix Miata <mrmazda@stanis.net> - 2024-07-05 04:40 +0200
      Re: Debian 11 and IPv4 static IP address David Christensen <dpchrist@holgerdanske.com> - 2024-07-05 05:40 +0200
        Re: Debian 11 and IPv4 static IP address Felix Miata <mrmazda@stanis.net> - 2024-07-05 06:10 +0200
          Re: Debian 11 and IPv4 static IP address David Christensen <dpchrist@holgerdanske.com> - 2024-07-06 03:20 +0200
            Re: Debian 11 and IPv4 static IP address Max Nikulin <manikulin@gmail.com> - 2024-07-06 04:10 +0200
              Re: Debian 11 and IPv4 static IP address David Christensen <dpchrist@holgerdanske.com> - 2024-07-06 07:00 +0200
                Re: Debian 11 and IPv4 static IP address jeremy ardley <jeremy.ardley@gmail.com> - 2024-07-06 09:30 +0200
                Re: Debian 11 and IPv4 static IP address Detlef Vollmann <dv@vollmann.ch> - 2024-07-06 12:50 +0200
                  Re: Debian 11 and IPv4 static IP address Marc SCHAEFER <schaefer@alphanet.ch> - 2024-07-06 17:20 +0200
                Re: Debian 11 and IPv4 static IP address Greg Wooledge <greg@wooledge.org> - 2024-07-06 16:10 +0200
              Re: Debian 11 and IPv4 static IP address Detlef Vollmann <dv@vollmann.ch> - 2024-07-06 12:30 +0200
            Re: Debian 11 and IPv4 static IP address George at Clug <Clug@goproject.info> - 2024-07-06 06:20 +0200
            Re: Debian 11 and IPv4 static IP address jeremy ardley <jeremy.ardley@gmail.com> - 2024-07-06 06:40 +0200
              Re: Debian 11 and IPv4 static IP address Detlef Vollmann <dv@vollmann.ch> - 2024-07-06 12:40 +0200
      Re: Debian 11 and IPv4 static IP address jeremy ardley <jeremy.ardley@gmail.com> - 2024-07-05 07:20 +0200
        Re: Debian 11 and IPv4 static IP address jeremy ardley <jeremy.ardley@gmail.com> - 2024-07-05 07:30 +0200
    Re: Debian 11 and IPv4 static IP address jeremy ardley <jeremy.ardley@gmail.com> - 2024-07-05 06:20 +0200
    Re: Debian 11 and IPv4 static IP address Franco Martelli <martellif67@gmail.com> - 2024-07-05 20:50 +0200

#270846 — Debian 11 and IPv4 static IP address

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-07-05 04:10 +0200
SubjectDebian 11 and IPv4 static IP address
Message-ID<IWGyB-7KGl-1@gated-at.bofh.it>
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:

root@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

[toc] | [next] | [standalone]


#270847

FromFelix Miata <mrmazda@stanis.net>
Date2024-07-05 04:40 +0200
Message-ID<IWH1D-7KWg-1@gated-at.bofh.it>
In reply to#270846
David Christensen composed on 2024-07-04 19:06 (UTC-0700):

> 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:

> root@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"?

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

[toc] | [prev] | [next] | [standalone]


#270851

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-07-05 05:40 +0200
Message-ID<IWHXH-7Lws-1@gated-at.bofh.it>
In reply to#270847
On 7/4/24 19:30, Felix Miata wrote:
> David Christensen composed on 2024-07-04 19:06 (UTC-0700):
>> 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:
>> <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
>> provides some example settings that I believe I can adapt to my use-case:
>> <snip>
>> 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"?
> 
> 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'


2024-07-04 20:26:35 root@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          -


> Do the same with whatever "manages" /etc/resolv.conf, 


How do I determine what 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.


2024-07-04 20:15:43 root@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

[toc] | [prev] | [next] | [standalone]


#270852

FromFelix Miata <mrmazda@stanis.net>
Date2024-07-05 06:10 +0200
Message-ID<IWIqJ-7LVE-1@gated-at.bofh.it>
In reply to#270851
David Christensen composed on 2024-07-04 20:29 (UTC-0700):

> Felix Miata wrote:

>> David Christensen composed on 2024-07-04 19:06 (UTC-0700):

>>> 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:
>>> <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
>>> provides some example settings that I believe I can adapt to my use-case:
>>> <snip>
>>> 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"?

>> 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'

> 2024-07-04 20:26:35 root@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          -

Usually the only unit among the above I need enabled is systemd-networkd.socket.

>> 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.

>> 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.

> 2024-07-04 20:15:43 root@laalaa ~
> # 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.

> 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

[toc] | [prev] | [next] | [standalone]


#270875

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-07-06 03:20 +0200
Message-ID<IX2fL-7qw-1@gated-at.bofh.it>
In reply to#270852
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

[toc] | [prev] | [next] | [standalone]


#270876

FromMax Nikulin <manikulin@gmail.com>
Date2024-07-06 04:10 +0200
Message-ID<IX329-7VR-3@gated-at.bofh.it>
In reply to#270875
On 06/07/2024 08:16, David Christensen wrote:
> I can find no statement in The Debian Administrator's Handbook regarding 
> disabling DHCP when using a static IP:
[...]
> 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:

 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.

[toc] | [prev] | [next] | [standalone]


#270880

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-07-06 07:00 +0200
Message-ID<IX5GF-9vx-1@gated-at.bofh.it>
In reply to#270876
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

[toc] | [prev] | [next] | [standalone]


#270882

Fromjeremy ardley <jeremy.ardley@gmail.com>
Date2024-07-06 09:30 +0200
Message-ID<IX81P-b3F-9@gated-at.bofh.it>
In reply to#270880

On 6/7/24 12:51, David Christensen wrote:
> 
> 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

[toc] | [prev] | [next] | [standalone]


#270886

FromDetlef Vollmann <dv@vollmann.ch>
Date2024-07-06 12:50 +0200
Message-ID<IXb9n-cV1-5@gated-at.bofh.it>
In reply to#270880
On 7/6/24 06:51, David Christensen wrote:

> 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

[toc] | [prev] | [next] | [standalone]


#270895

FromMarc SCHAEFER <schaefer@alphanet.ch>
Date2024-07-06 17:20 +0200
Message-ID<IXfmF-fGx-5@gated-at.bofh.it>
In reply to#270886
Hello,

On Sat, Jul 06, 2024 at 12:49:32PM +0200, Detlef Vollmann wrote:
> 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 :)

[toc] | [prev] | [next] | [standalone]


#270890

FromGreg Wooledge <greg@wooledge.org>
Date2024-07-06 16:10 +0200
Message-ID<IXegW-f1U-3@gated-at.bofh.it>
In reply to#270880
On Fri, Jul 05, 2024 at 21:51:09 -0700, David Christensen wrote:
> 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.

[toc] | [prev] | [next] | [standalone]


#270884

FromDetlef Vollmann <dv@vollmann.ch>
Date2024-07-06 12:30 +0200
Message-ID<IXaQ1-cNU-1@gated-at.bofh.it>
In reply to#270876
On 7/6/24 04:06, Max Nikulin wrote:
> On 06/07/2024 08:16, David Christensen wrote:

>> The following sentence:
>>
>> "Make sure to disable all DHCP services, e.g. dhcpcd."
>>
>> Was added at revision 97:
> 
>  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

[toc] | [prev] | [next] | [standalone]


#270878

FromGeorge at Clug <Clug@goproject.info>
Date2024-07-06 06:20 +0200
Message-ID<IX53X-9cx-1@gated-at.bofh.it>
In reply to#270875
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


On Saturday, 06-07-2024 at 11:16 David Christensen wrote:
> 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
> 
> 

[toc] | [prev] | [next] | [standalone]


#270879

Fromjeremy ardley <jeremy.ardley@gmail.com>
Date2024-07-06 06:40 +0200
Message-ID<IX5nj-9oZ-3@gated-at.bofh.it>
In reply to#270875

On 6/7/24 09:16, David Christensen wrote:
> 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
> 

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.

[toc] | [prev] | [next] | [standalone]


#270885

FromDetlef Vollmann <dv@vollmann.ch>
Date2024-07-06 12:40 +0200
Message-ID<IXaZH-cRh-5@gated-at.bofh.it>
In reply to#270879
On 7/6/24 06:37, jeremy ardley wrote:

> 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.

> 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

[toc] | [prev] | [next] | [standalone]


#270855

Fromjeremy ardley <jeremy.ardley@gmail.com>
Date2024-07-05 07:20 +0200
Message-ID<IWJwt-7MER-1@gated-at.bofh.it>
In reply to#270847

On 5/7/24 10:30, Felix Miata wrote:
> 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:

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)

[toc] | [prev] | [next] | [standalone]


#270856

Fromjeremy ardley <jeremy.ardley@gmail.com>
Date2024-07-05 07:30 +0200
Message-ID<IWJG9-7MI0-3@gated-at.bofh.it>
In reply to#270855

On 5/7/24 13:13, jeremy ardley wrote:
> 
> 
> On 5/7/24 10:30, Felix Miata wrote:
>> 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:
> 
> 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)

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)

[toc] | [prev] | [next] | [standalone]


#270853

Fromjeremy ardley <jeremy.ardley@gmail.com>
Date2024-07-05 06:20 +0200
Message-ID<IWIAp-7LYN-1@gated-at.bofh.it>
In reply to#270846

On 5/7/24 10:06, David Christensen wrote:
> 
> 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"?

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

[toc] | [prev] | [next] | [standalone]


#270873

FromFranco Martelli <martellif67@gmail.com>
Date2024-07-05 20:50 +0200
Message-ID<IWWal-3u7-1@gated-at.bofh.it>
In reply to#270846
On 05/07/24 at 04:06, David Christensen wrote:
> 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:
> 
...
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web