Results 1 to 8 of 8

Thread: How to keep dns-nameservers line in interfaces?

  1. #1
    Join Date
    Dec 2009
    Beans
    27

    Question How to keep dns-nameservers line in interfaces?

    Hi guys,

    I'm running a server with Ubuntu 12.10. For some reason, however, the line
    Code:
    dns-nameservers 8.8.8.8 8.8.4.4
    disappears from time to time which causes severe mayhem, including mail messages not being delivered, etc.

    Could you tell me how to set up the DNS properly so that they stay in place no matter what?

    Thanks a lot!

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to keep dns-nameservers line in interfaces?

    Hi zkvvoob.

    Could you post the result of these commands?
    Code:
    apt-cache policy network-manager
    
    cat /etc/network/interfaces 
    
    apt-cache policy resolvconf 
    
    cat /etc/resolv.conf
    Regards.

  3. #3
    Join Date
    Dec 2009
    Beans
    27

    Re: How to keep dns-nameservers line in interfaces?

    Certainly, papibe. Here are the results:

    Code:
    apt-cache policy network-manager
    network-manager:
      Installed: (none)
      Candidate: 0.9.6.0-0ubuntu7
      Version table:
         0.9.6.0-0ubuntu7 0
            500 http://bg.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
    Code:
    cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
            address 192.168.0.105
            netmask 255.255.255.0
            network 192.168.0.0
            broadcast 192.168.0.255
            gateway 192.168.0.1
            dns-nameservers 8.8.8.8 8.8.4.4
    Code:
    apt-cache policy resolvconf
    resolvconf:
      Installed: 1.67ubuntu2
      Candidate: 1.67ubuntu2
      Version table:
     *** 1.67ubuntu2 0
            500 http://bg.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
            100 /var/lib/dpkg/status
    Code:
    cat /etc/resolv.conf
    # 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
    nameserver 8.8.8.8
    nameserver 8.8.4.4

  4. #4
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to keep dns-nameservers line in interfaces?

    Thanks. Everything looks OK at first sight.

    Is /etc/resolv.conf a link, isn't it? Could you post the result of this command?
    Code:
    ls -l /etc/resolv.conf
    There seems to be no new line on the interfaces file. Could you post the result of this command?
    Code:
    od -a /etc/network/interfaces
    Regards.

  5. #5
    Join Date
    Dec 2009
    Beans
    27

    Re: How to keep dns-nameservers line in interfaces?

    Here you go:
    Code:
    ls -l /etc/resolv.conf
    lrwxrwxrwx 1 root root 29 Apr  2 18:42 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
    Code:
    od -a /etc/network/interfaces
    0000000   #  sp   T   h   i   s  sp   f   i   l   e  sp   d   e   s   c
    0000020   r   i   b   e   s  sp   t   h   e  sp   n   e   t   w   o   r
    0000040   k  sp   i   n   t   e   r   f   a   c   e   s  sp   a   v   a
    0000060   i   l   a   b   l   e  sp   o   n  sp   y   o   u   r  sp   s
    0000100   y   s   t   e   m  nl   #  sp   a   n   d  sp   h   o   w  sp
    0000120   t   o  sp   a   c   t   i   v   a   t   e  sp   t   h   e   m
    0000140   .  sp   F   o   r  sp   m   o   r   e  sp   i   n   f   o   r
    0000160   m   a   t   i   o   n   ,  sp   s   e   e  sp   i   n   t   e
    0000200   r   f   a   c   e   s   (   5   )   .  nl  nl   #  sp   T   h
    0000220   e  sp   l   o   o   p   b   a   c   k  sp   n   e   t   w   o
    0000240   r   k  sp   i   n   t   e   r   f   a   c   e  nl   a   u   t
    0000260   o  sp   l   o  nl   i   f   a   c   e  sp   l   o  sp   i   n
    0000300   e   t  sp   l   o   o   p   b   a   c   k  nl  nl   #  sp   T
    0000320   h   e  sp   p   r   i   m   a   r   y  sp   n   e   t   w   o
    0000340   r   k  sp   i   n   t   e   r   f   a   c   e  nl   a   u   t
    0000360   o  sp   e   t   h   0  nl   i   f   a   c   e  sp   e   t   h
    0000400   0  sp   i   n   e   t  sp   s   t   a   t   i   c  nl  sp  sp
    0000420  sp  sp  sp  sp  sp  sp   a   d   d   r   e   s   s  sp   1   9
    0000440   2   .   1   6   8   .   0   .   1   0   5  nl  sp  sp  sp  sp
    0000460  sp  sp  sp  sp   n   e   t   m   a   s   k  sp   2   5   5   .
    0000500   2   5   5   .   2   5   5   .   0  nl  sp  sp  sp  sp  sp  sp
    0000520  sp  sp   n   e   t   w   o   r   k  sp   1   9   2   .   1   6
    0000540   8   .   0   .   0  nl  sp  sp  sp  sp  sp  sp  sp  sp   b   r
    0000560   o   a   d   c   a   s   t  sp   1   9   2   .   1   6   8   .
    0000600   0   .   2   5   5  nl  sp  sp  sp  sp  sp  sp  sp  sp   g   a
    0000620   t   e   w   a   y  sp   1   9   2   .   1   6   8   .   0   .
    0000640   1  nl  ht   d   n   s   -   n   a   m   e   s   e   r   v   e
    0000660   r   s  sp   8   .   8   .   8   .   8  sp   8   .   8   .   4
    0000700   .   4  nl
    0000703

  6. #6
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to keep dns-nameservers line in interfaces?

    Everything looks fine.

    The only think I can think of is that the dns line is indented using a tab instead of spaces, like the others. That shouldn't a problem though.

    Is that line really disappearing from interfaces, or just the correct DNS not appearing on resolv.conf after boot?

    If so, I would suspect the problem comes from the resolvconf package. In such a case, it could be valuable to reconfigure it:
    Code:
    sudo dpkg-reconfigure resolvconf
    Let us know how it goes.
    Regards.

  7. #7
    Join Date
    Mar 2005
    Beans
    211

    Re: How to keep dns-nameservers line in interfaces?

    Quote Originally Posted by zkvvoob View Post
    I'm running a server with Ubuntu 12.10. For some reason, however, the line
    Code:
    dns-nameservers 8.8.8.8 8.8.4.4
    disappears from time to time which causes severe mayhem, including mail messages not being delivered, etc.

    Could you tell me how to set up the DNS properly so that they stay in place no matter what?
    Can you confirm that you mean that the "dns-nameservers" line disappears from /etc/network/interfaces? That would be *very* unusual.

  8. #8
    Join Date
    Dec 2009
    Beans
    27

    Re: How to keep dns-nameservers line in interfaces?

    Hi guys,

    During the initial configuration of the server, I explicitly made sure that the interfaces contained a setting for DNS. However, when I completed everything I went on to update and upgrade the installation, none of the repositories could be resolved. Then I checked the interfaces file again and the dns-nameservers line was simply empty. I added it and it all went on as normal.

    Last night, however, when I was checking why emails were arriving but could not be sent, I thought I should check the interfaces file and again - that notorious line was not there.

    Granted, I am new to Linux and I might have done a few things wrong, but one thing I am sure of and that is that I have personally set these DNSs numerous times.

    Meanwhile, I'll keep a look whether this thing happens again and if it does, I'll go with papibe's suggesion.

    Thanks a lot!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •