Article 6KGN3 [SOLVED] Switching Debian Bookworm install from DHCP to static IP

[SOLVED] Switching Debian Bookworm install from DHCP to static IP

by
rnturn
from LinuxQuestions.org on (#6KGN3)
How to do this?

I'm running into numerous examples online that lead nowhere. Mainly editing /etc/network/interfaces has gotten nothing but error messages when I try to restart the network services. I'm trying to configure a static address to deal with a problem with NFS mount failures that I strongly suspect are due to my network having gotten configured for DHCP.

Here's the problem:
Code:# ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 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
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether d4:3d:7e:df:2d:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.13.226/24 brd 192.168.13.255 scope global dynamic noprefixroute enp3s0
valid_lft 40986sec preferred_lft 40986sec
inet6 fe80::d63d:7eff:fedf:2d45/64 scope link noprefixroute
valid_lft forever preferred_lft foreverSo I'm working with "enp3s0". OK.

I'm using the following file -- patterned from an post found online (so it could be trash for all I know) -- in /etc/network/interfaces.d:
Code:auto enp3s0
iface enp3s0 inet static
address 192.168.13.7
netmask 255.255.255.0
gateway 192.168.13.1
dns-nameservers 192.168.13.178My system has "enp3s0" as the sole network card but when I try restarting networking services, I get an error message telling me to run the following commands for clues. (No clues to be found, though.)

Code:# systemctl status networking.service
networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; preset: enabled)
Active: active (exited) since Wed 2024-03-20 18:12:21 CDT; 1min 24s ago
Docs: man:interfaces(5)
Process: 3582 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
Process: 3613 ExecStart=/bin/sh -c if [ -f /run/network/restart-hotplug ]; then /sbin/ifup -a --read-environment --allow=hotplug; fi>
Main PID: 3613 (code=exited, status=0/SUCCESS)
CPU: 31ms

Mar 20 18:12:21 kadath systemd[1]: Starting networking.service - Raise network interfaces...
Mar 20 18:12:21 kadath systemd[1]: Finished networking.service - Raise network interfaces.No apparent errors.

Journalctl's output is:

Code:# journalctl -xeu networking.service

A start job for unit networking.service has begun execution.

The job identifier is 2880.
Mar 20 18:12:21 kadath systemd[1]: Finished networking.service - Raise network interfaces.
Subject: A start job for unit networking.service has finished successfully
Defined-By: systemd
Support: https://www.debian.org/support

A start job for unit networking.service has finished successfully.

The job identifier is 2880.(Boldface mine)

"ip addr list" shows that the address was, indeed modified with no apparent errors. Sadly, I have both the static IP and the one assigned by DHCP assigned to "enp3s0" now.

(I'm still receiving access denied error messages when I try to mount an NFS filesystem on the LAN.)

I'm going to reboot (when did Linux become Windows, I wonder) so see what the network card has assigned to it but I'm not holding out much hope. (I'm prepared to be surprised, though.)

Any hints most welcome.

TIA...

UPDATE:

Yes. A reboot was needed. And it solved the NFS problem.

Q: Could the reboot have somehow been avoided? Perhaps by stopping the network by hand and restarting it by hand? (I thought that's what "systemctl restart networking.service" would do for you. Silly me.)
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments