LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-20-2024, 06:30 PM   #1
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Switching Debian Bookworm install from DHCP to static IP


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 forever
So 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.178
My 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.)

Last edited by rnturn; 03-20-2024 at 06:45 PM. Reason: Update
 
Old 03-20-2024, 06:58 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,708

Rep: Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898
Networking is controlled by Network Manager now days. If you are running a desktop the easiest method would be to use the NM applet and configure enp3s0 with a static IP address. You can also do it from the command line using nmcli.

Is your NFS share mounted via fstab? If so are you using the _netdev option?
Are you running nfs V3 or V4 on the server?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Update on Debian-Bookworm and Why Did Bookworm Remove Some Packages? kevinbenko Linux - Newbie 4 07-09-2022 09:00 AM
LXer: Debian 11 "Bullseye" and Debian 12 "Bookworm" Are Coming After Debian 10 "Buster" LXer Syndicated Linux News 0 04-18-2018 12:26 PM
Help switching from Static IP to DHCP on Redhat Linux 9 asilentmurmur Linux - Networking 8 08-16-2005 08:08 PM
switching from dhcp to static lost internet basq3 Linux - Networking 8 03-29-2005 09:44 AM
Switching from DHCP to static IP class-a Linux - Networking 0 09-19-2001 03:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration