Cannot disable dhcp for network interface

Kernels & Hardware, configuring network, installing services

Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 09:09

I installed a new system today from the new Debian 10 release, using expert mode and setting a static IP address in the installation process.

Installation went ok. When I went to log in remotely via SSH, so I could sit on the couch, I found that the system was ignoring /etc/network/interfaces and getting an address via dhcp. At this stage the interfaces config looked like:
Code: Select all
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet static
        address 192.168.1.15/24
        gateway 192.168.1.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.1.1
        dns-search mylocalhome


I added
Code: Select all
auto enp2s0
at the top of the enp2s0 section and rebooted. Now that interface has TWO IP addresses, 192...15 from the static IP set in interfaces and 192...106 set via dhcp.

What's going on? How do I stop the dhcp side of things? (And why does a fairly vanilla install of stable have this bug?)
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby reinob » 2019-07-22 09:20

Maybe systemd-networkd or some other networkg manager is working independently of your preference during installation. Sounds like a bug.

Check the output of "systemctl status systemd-networkd", especially if it says "active (running"). Maybe the last few log lines will show whether it's doing DHCP, like:

Code: Select all
..
Jul 22 12:00:21 blitz systemd-networkd[282]: eth0: Gained carrier
Jul 22 12:00:21 blitz systemd-networkd[282]: eth0: DHCPv4 address 192.168.178.42/24 via 192.168.178.1
Jul 22 12:00:21 blitz systemd-networkd[282]: eth0: Configured
reinob
 
Posts: 750
Joined: 2014-06-30 11:42

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 09:25

That seems to not be the issue
Code: Select all
# systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 09:31

Did you try to disable DHCP in your router ?
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 09:41

That would work obviously, most of the rest of the network depends on it though.
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 09:49

deadwax wrote:I added auto enp2s0 at the top of the enp2s0 section and rebooted. )

Probably the problem. My /etc/network/interfaces file contains only this:
Code: Select all
auto lo
iface lo inet loopback

but I have created a /etc/systemd/network/50-enp2s0.link file.

Code: Select all
[Match]
MACAddress=d4:55:7e:7e:0c:54

[Link]
Name=enp2s0

and /etc/systemd/network/10-static-enp2s0.network
Code: Select all
[Match]
MACAddress=d4:55:7e:7e:0c:54

[Network]
Address=192.168.0.50/24
Gateway=192.168.0.1
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 10:12

Could you explain why the auto bringing up of the interface would be the problem?

My (possibly flawed) understanding is that without that line the interface would have to be brought up manually/explicitly and that's pretty much what happens. Without it there the static interface described in network/interfaces does not in fact automatically get brought up - with it it does.

What I'm chasing is what is bringing up the secondary dynamic IP.
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 10:14

Because you probably mix two Network configuration systems.
Network connections are managed by systemd.
Code: Select all
systemctl status {systemd-networkd,systemd-resolved,networking,NetworkManager,systemd-hostnamed,openvpn}
Last edited by L_V on 2019-07-22 10:18, edited 1 time in total.
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 10:18

But systemd-networkd is disabled, /etc/systemd/network/ is empty and /etc/systemd/networkd.conf is entirely commented out?

I'm not saying you are wrong, but where is the config?

(This is how the system was from a stock install BTW)
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 10:22

And network-manager is installed or not ?
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 10:27

Not installed.
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 10:29

The relevant part of the output of
Code: Select all
systemctl status {systemd-networkd,systemd-resolved,networking,NetworkManager,systemd-hostnamed,openvpn}

that you posted earlier appears to be

Code: Select all
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2019-07-22 18:53:14 AEST; 2h 15min ago
     Docs: man:interfaces(5)
  Process: 395 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
 Main PID: 395 (code=exited, status=0/SUCCESS)


But this appears to take its config from /etc/network/interfaces, which is fine.
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 10:38

And this
Code: Select all
find /etc/network/ -type f
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Re: Cannot disable dhcp for network interface

Postby deadwax » 2019-07-22 10:41

Code: Select all
# find /etc/network/ -type f
/etc/network/if-up.d/avahi-daemon
/etc/network/interfaces
deadwax
 
Posts: 14
Joined: 2019-07-22 08:54

Re: Cannot disable dhcp for network interface

Postby L_V » 2019-07-22 10:42

and this
Code: Select all
grep -v \# /etc/network/interfaces
L_V
 
Posts: 1170
Joined: 2007-03-19 09:04

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 11 guests

fashionable