So welcome to the linux world !
It could be tough in the beginning but you'll surely learn something new and fun. In your /etc/network/interfaces file you'll probably have something like:
"iface eth0 inet dhcp"
This gives you a dynamic address with an IP,gateway,subnet and DNS automatically set from your dhcp server
Set it manually (see examples inside it or take a look at whatever distro you'd like) and your resolv.conf won't be overwritten by dhcpd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
auto eth0:1
iface eth0:1 inet static
address 192.168.4.147
netmask 255.255.255.192
eth0 - internet
eth0:1 - local net
With Raspbian it works without "dns-nameservers...." string and with resolv.conf filled with nameserver.
With Moebius it still works with local net but does not work with internet (even with "dns-nameservers...." string) while resolv.conf stays empty. So I must fill in resolv.conf anyway, then internet is OK. But resolv.conf is getting clear after reboot.
What did I miss?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank for the prompt reply.
Now when I have registered maybe my post will be visible at least.
Actually I have done needed changes to "interfaces" like this:
auto eth0:1
iface eth0:1 inet static
address 192.168.4.147
netmask 255.255.255.192
No mention of dhcp.
And of course there is nameserver in resolv.conf.
Exactly the same programm works fine on Raspbian. And on Moebius after reboot resolv.conf goes empty again. So something rewrites it.
What did I miss?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2015-02-26
Same problem here. Also, if I set dns in resolv.conf without rebooting, SSLCertificate error is prompt when I run apt-get update.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the ssl certificate error please double check your date/time, if it's set to something far from current timedate you'll have errors with signed repositories. APT utils support signed repository and that's what I'm using on Github (not my choice but github relies on https). Set the current date and then run your apt-get update
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As a temporary solutuon I created saveresolv file with "nameserver xxx.xxx.xxx.xxx" string and add command cp /ext/saveresolv /ext/resolv.conf at the end of rc.local. In this odd way resolv.conf recovers after boot.
But what did clear it during boot?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you may see I'm heavily using busybox for several services. I'm trying to keep a minimal footprint (too minimal sometimes) and busybox is a big part of it. There're no manual changes or something that rewrites the resolv.conf file in my init scripts but maybe busybox does it on behalf. There're two possible solutions:
- yours. Ugly but effective because you simply don't care of what is doing and you keep your own file where it should be
- config. I need to check where busybox recreates the resolv.conf and I need to disable it. If there's something that's configurable I'll do it and report it here. I can even recompile busybox from scratch and understand how I can avoid this behaviour
As you may see I'm not using systemd (and I'll avoid it as long as I can) so making changes to the boot sequence is pretty easy.
I'll keep you informed on results (need to check internal udhcpd docs as well)
Ben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I am new to linux, so I am learning by examples.
I use static IP and put nameserver in resolv.conf. Internet starts to work but after reboot resolv.conf is empty again.
What is the right method to feed DNS in this distribution?
Thanks!
Mike.
So welcome to the linux world !
It could be tough in the beginning but you'll surely learn something new and fun. In your /etc/network/interfaces file you'll probably have something like:
"iface eth0 inet dhcp"
This gives you a dynamic address with an IP,gateway,subnet and DNS automatically set from your dhcp server
Set it manually (see examples inside it or take a look at whatever distro you'd like) and your resolv.conf won't be overwritten by dhcpd
Hi Andrea,
Thanks for quick reply.
My "intefaces" file is:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.125
netmask 255.255.255.0
gateway 192.168.0.103
dns-nameservers 194.6.222.10
auto eth0:1
iface eth0:1 inet static
address 192.168.4.147
netmask 255.255.255.192
eth0 - internet
eth0:1 - local net
With Raspbian it works without "dns-nameservers...." string and with resolv.conf filled with nameserver.
With Moebius it still works with local net but does not work with internet (even with "dns-nameservers...." string) while resolv.conf stays empty. So I must fill in resolv.conf anyway, then internet is OK. But resolv.conf is getting clear after reboot.
What did I miss?
Thanks!
Thank for the prompt reply.
Now when I have registered maybe my post will be visible at least.
Actually I have done needed changes to "interfaces" like this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.125
netmask 255.255.255.0
gateway 192.168.0.103
auto eth0:1
iface eth0:1 inet static
address 192.168.4.147
netmask 255.255.255.192
No mention of dhcp.
And of course there is nameserver in resolv.conf.
Exactly the same programm works fine on Raspbian. And on Moebius after reboot resolv.conf goes empty again. So something rewrites it.
What did I miss?
Thanks!
Same problem here. Also, if I set dns in resolv.conf without rebooting, SSLCertificate error is prompt when I run apt-get update.
For the ssl certificate error please double check your date/time, if it's set to something far from current timedate you'll have errors with signed repositories. APT utils support signed repository and that's what I'm using on Github (not my choice but github relies on https). Set the current date and then run your apt-get update
As a temporary solutuon I created saveresolv file with "nameserver xxx.xxx.xxx.xxx" string and add command cp /ext/saveresolv /ext/resolv.conf at the end of rc.local. In this odd way resolv.conf recovers after boot.
But what did clear it during boot?
As you may see I'm heavily using busybox for several services. I'm trying to keep a minimal footprint (too minimal sometimes) and busybox is a big part of it. There're no manual changes or something that rewrites the resolv.conf file in my init scripts but maybe busybox does it on behalf. There're two possible solutions:
- yours. Ugly but effective because you simply don't care of what is doing and you keep your own file where it should be
- config. I need to check where busybox recreates the resolv.conf and I need to disable it. If there's something that's configurable I'll do it and report it here. I can even recompile busybox from scratch and understand how I can avoid this behaviour
As you may see I'm not using systemd (and I'll avoid it as long as I can) so making changes to the boot sequence is pretty easy.
I'll keep you informed on results (need to check internal udhcpd docs as well)
Ben
I had this problem. I tried lots of stuff but couldn't find out what was overwriting the file.
Normally the file is a symlink to some other copy. In the end I erased the link, rewrote it as an ordinary file, and then turned on the immutable bit:
chattr +i /etc/resolv.conf
That seems to have worked, although it is a bit of an ugly hack. I agree, it is a real pain that this file gets overwritten silently.