Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

stretch static ip missing out dns

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
creepwood
Posts: 28
Joined: 2013-09-15 20:29

stretch static ip missing out dns

#1 Post by creepwood »

I only use my debian home server sporadically and since I had some problems with my old installation I decided to install 9 on a new a drive. The first few steps I take when I make a new installation I install sudo, add my user to sudo group, set up fstab so that it mounts my drives.

The third thing I do is set up my system to a static ip. Every time I try to set my IP in /etc/network/interfaces and after a reboot it comes back with the right IP number but there is no name server resolving going on. I've been scouring the interwebs for a few hours for a solution since it should be such a simple thing to workout, but what confuses me even more is that most of these supposedly Debian 9 guides on how to do it still use the old names for NIC's like eth0 while I read that the new names are something enp5s0 (like the one I have) so I don't really trust that the guides are for Stretch. (and I can't remember that I had to do this for Jessie with the DNS resolving)

I read at https://www.debian.org/doc/manuals/debi ... resolution that you're suppose to add /etc/resolv.conf but after reboot the file is missing again. I also get a failed message during boot (only happens when I set static ip in /etc/network/interfaces)

Code: Select all

 [failed] to start raise network interfaces. 
Now I'm at loss and really don't know what to do to fix this problem before continuing with my configuration.

edit: the text I add in /etc/network/interfaces

Code: Select all

auto enp5s0
iface enp5s0 inet static
        address 10.101.242.21
        netmask 255.255.255.0
        gateway 10.101.242.21

peter_irich
Posts: 1406
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 11 times

Re: stretch static ip missing out dns

#2 Post by peter_irich »

/etc/resolv.conf creates automatically by resolvconf from the same name package.
Try set dns-server in /etc/network/interfaces like:
dns-nameserver <ip>
for example,
dns-nameserver 8.8.4.4
or your provider dns-server.
Also you can set the list of IPs:
dns-nameservers ip1 ip2

Peter.

User avatar
orythem27
Posts: 252
Joined: 2017-05-11 07:59
Location: P.R. China

Re: stretch static ip missing out dns

#3 Post by orythem27 »

To add to Peter's advice, make sure you have the package "resolvconf" installed, and use `dpkg-reconfigure resolvconf` to ensure automatically management of /etc/resolv.conf. In this case, /etc/resolv.conf should be a symlink of /run/resolvconf/resolv.conf.

If you are using a graphical desktop environment and NetworkManager, /etc/resolv.conf will be a symlink to /var/run/NetworkManager/resolv.conf and managed by NetworkManager.

creepwood
Posts: 28
Joined: 2013-09-15 20:29

Re: stretch static ip missing out dns

#4 Post by creepwood »

orythem27 wrote:If you are using a graphical desktop environment and NetworkManager, /etc/resolv.conf will be a symlink to /var/run/NetworkManager/resolv.conf and managed by NetworkManager.
I did install gnome and it boots into it but I'm not using it. Will that be counted as using it and is the reason why setting a nameserver as usual is the reason?

creepwood
Posts: 28
Joined: 2013-09-15 20:29

Re: stretch static ip missing out dns

#5 Post by creepwood »

peter_irich wrote:/etc/resolv.conf creates automatically by resolvconf from the same name package.
Try set dns-server in /etc/network/interfaces like:
dns-nameserver <ip>
This was one of the first things I tried to do but it doesn't seem to make a difference.

User avatar
orythem27
Posts: 252
Joined: 2017-05-11 07:59
Location: P.R. China

Re: stretch static ip missing out dns

#6 Post by orythem27 »

creepwood wrote:This was one of the first things I tried to do but it doesn't seem to make a difference.
For this to work, make sure you have the package "resolvconf" installed, and use `dpkg-reconfigure resolvconf` to ensure automatically management of /etc/resolv.conf. In this case, /etc/resolv.conf should be a symlink of /run/resolvconf/resolv.conf.

creepwood
Posts: 28
Joined: 2013-09-15 20:29

Re: stretch static ip missing out dns

#7 Post by creepwood »

orythem27 wrote:For this to work, make sure you have the package "resolvconf" installed, and use `dpkg-reconfigure resolvconf` to ensure automatically management of /etc/resolv.conf. In this case, /etc/resolv.conf should be a symlink of /run/resolvconf/resolv.conf.
Not entirely sure I'm doing this right. I did install resolvconf, did the reconfigure and created a symlink. My resolv.conf still gets overwritten after a reboot. I'm a novice but it sounds backwards to edit /run/resolvconf/resolv.conf but is this what I should do?

User avatar
orythem27
Posts: 252
Joined: 2017-05-11 07:59
Location: P.R. China

Re: stretch static ip missing out dns

#8 Post by orythem27 »

creepwood wrote:you're suppose to add /etc/resolv.conf but after reboot the file is missing again....
...My resolv.conf still gets overwritten after a reboot.
Does /etc/resolv.conf get deleted or its content get overwritten (to what?) ?

creepwood
Posts: 28
Joined: 2013-09-15 20:29

Re: stretch static ip missing out dns

#9 Post by creepwood »

orythem27 wrote:Does /etc/resolv.conf get deleted or its content get overwritten (to what?) ?
I comment out all my settings in /etc/network/interfaces and wrote a config in /etc/resolv.conf so that the machine will get a dynamic IP from the dhcp server. resolv.conf stayed the same, my settings were still there after a reboot. I uncommented my static settings in /etc/network/interfaces, made sure that my settings were still in /etc/resolv.conf and they were. rebooted. settings in resolv.conf are gone, the only thing that remains is

Code: Select all

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
So something is overwriting my settings in resolv.conf

This is what my /etc/network/interfaces look like

Code: Select all

# 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

allow-hotplug enp5s0
iface enp5s0 inet static
        address 10.101.242.21
        netmask 255.255.255.0
        gateway 10.101.242.21
        dns-nameservers 10.101.242.1
I've tried both with auto and allow-hutplug and I tried both with dns-nameservers and without them. no difference

creepwood
Posts: 28
Joined: 2013-09-15 20:29

Re: stretch static ip missing out dns

#10 Post by creepwood »

wizard10000 wrote:Why not set the static IP with a MAC reservation on your router?
Because many services on the server itself demands static ip to be set in the machine.
wizard10000 wrote:Also, your gateway address is the same as your static IP, which ain't gonna work unless the machine actually *is* the gateway ;)
That did it, I know I have had it on 10.101.242.1 before but somehow when I rewrote it must've slipped. Now it works, thank you so much for pointing that out! Now onward with the configuration!

Post Reply