LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-16-2017, 04:52 PM   #1
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Rep: Reputation: 229Reputation: 229Reputation: 229
how to use dns on non-NetworkManager Debian Stretch correctly?


debian Stretch
Not using NetworkManager, dont want to use it. on my debian jessie machine, using networking instead of NetworkManager works fine, but cant get dns to work on stretch...

Code:
root@stretchmachine:~# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enable
   Active: inactive (dead)
     Docs: man:NetworkManager(8)

Nov 16 16:31:47 stretchmachine systemd[1]: Network Manager is not active.
Code:
root@stretchmachine:~# systemctl status networking
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: active (exited) since Thu 2017-11-16 16:31:49 CST; 4min 29s ago
     Docs: man:interfaces(5)
  Process: 572 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
  Process: 298 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery 
 Main PID: 572 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/networking.service

Nov 16 16:31:47 stretchmachine systemd[1]: Starting Raise network interfaces...
Nov 16 16:31:49 stretchmachine systemd[1]: Started Raise network interfaces.
This is what I was getting at the bottom of vi editor when i try to edit /etc/resolv.conf
Code:
"/etc/resolv.conf"
"/etc/resolv.conf" E166: Can't open linked file for writing
Press ENTER or type command to continue
i noticed it had a link so i deleted, recreated, and put my dns, domain, and search in there.
Code:
root@stretchmachine:/etc# ls -latr resolv.conf 
lrwxrwxrwx 1 root root 35 Nov 16 14:35 resolv.conf -> /var/run/NetworkManager/resolv.conf
root@stretchmachine:/etc# rm resolv.conf 
root@stretchmachine:/etc# ls -latr resolv.conf 
ls: cannot access 'resolv.conf': No such file or directory
root@stretchmachine:/etc# vi resolv.conf
root@stretchmachine:/etc# ping google.com
ping: google.com: Name or service not known
but can ping local and internet IP's all day
Code:
root@stretchmachine:/etc# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=7.98 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=7.32 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=7.32 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 7.321/7.542/7.983/0.327 ms

Last edited by erik2282; 11-16-2017 at 04:55 PM.
 
Old 11-16-2017, 10:02 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
In order to use host names instaed of IP Addresses you need to configure your resolv.conf file.
HERE are soem examples of what needs to be placed into the resolv.conf file.
Be aware if you are using DHCP then this file should be over written by what the DHCP server supplies.

Last edited by lazydog; 11-16-2017 at 10:03 PM.
 
Old 11-16-2017, 11:04 PM   #3
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Original Poster
Rep: Reputation: 229Reputation: 229Reputation: 229
Thanks. Yes I know that I have to use that file. In my post I said that I was using that file and still DNS doesn't work.
 
Old 11-17-2017, 02:47 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Did you actually remove the network-manager?
Code:
apt-get remove --purge network-manager
My experience is that you have to actually remove the package in order to get rid of that annoying /etc/resolv.conf link across reboots. I had to do this in Debian 9 Squeeze, but I did not have to do this in Debian 8 Jessie.

After getting rid of the annoying /etc/resolv.conf link, I manually created my own /etc/resolv.conf using my gateway's IP address:

Code:
nameserver 192.168.0.1

Last edited by IsaacKuo; 11-17-2017 at 02:51 AM.
 
Old 11-17-2017, 09:44 AM   #5
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Original Poster
Rep: Reputation: 229Reputation: 229Reputation: 229
No I didn't remove Network Manager. Is this something new that has to be done in Debain 9 to use the networking service instead of Network Manager? In all my centos and debian machines in the past I've never had to uninstall Network Manager, I've always just disabled the service. I guess I can try it, though.

I've never seen that sym link before on other operating systems, this is the first time. I did rm the file and recreate it myself and my i have my dns server in resolv.conf. Anyway I rebooted, still with network manger installed but service disabled, and the link did not recreate itself.
 
Old 11-17-2017, 09:52 AM   #6
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Original Poster
Rep: Reputation: 229Reputation: 229Reputation: 229
ahh!! So after removing network-manager i tested pinging a hostname, and still couldn't ping. I check resolv.conf and found the issue. I had misspelled the nameserver line, I wrote it as namserver.. errr... now its working... thanks guys.
 
Old 11-17-2017, 01:40 PM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
I'm not sure exactly what circumstances will cause network-manager to annoyingly recreate that link. It was a problem for my machines with nfs-root (booting with / on an nfs share, not a local drive).
 
  


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
Debian Stretch CD with LXDE? lucmove Linux - Software 2 09-26-2017 07:19 PM
LXer: How to upgrade Debian 8 Jessie to Debian 9 Stretch LXer Syndicated Linux News 0 06-16-2017 02:11 AM
[SOLVED] Stability of Debian Stretch joe_2000 Debian 6 05-24-2017 07:45 AM
networkmanager not working correctly in kde3 rabbit2345 SUSE / openSUSE 3 11-16-2009 03:57 PM
NetworkManager & gprs/ppp DNS: after using wlan/eth0, DNS for ppp doesn't work mtess Linux - Networking 3 03-12-2008 03:31 PM

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

All times are GMT -5. The time now is 04:30 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