Guest sproot Posted July 27, 2006 Report Share Posted July 27, 2006 /etc/resolv.conf is built automatically by dhclient on boot, I need to add some "search" entries to it. The only ref I can find says that adding the line in /etc/sysconfig/network will cause it to be populated into /etc/resolv.conf, but this isn't happening. Is there a simple way, or am I going to have to edit the eth0 start up scripts? Any assistance is appreciated. Cheers, sproot. Quote Link to comment Share on other sites More sharing options...
pmpatrick Posted July 27, 2006 Report Share Posted July 27, 2006 You can try just hand editing /etc/resolve.conf. If you have the ip of a specific nameserver the systax is: nameserver <insert ip> If you have a search domain, the sytax is: search <insert domain name> It's just a matter of adding a line or two per the above and restarting your network. IIRC I've done this in the past without any problem when using dhcp and it seems to have stuck on a reboot. I specifically remember having to manually do this when comcast's dns servers were all screwed up; I had to manually enter the ip of a nameserver that was working. Quote Link to comment Share on other sites More sharing options...
Guest sproot Posted July 27, 2006 Report Share Posted July 27, 2006 I tried editing it, but I think that when dhcp *is* working it overwrites it. I managed to get it to stick by editing /sbin/dhclient-script, but it didn't fix the problem: ping $some_server still fails if I don't use the fqdn. I think it's because it queries the nameserver first, and the nameserver can't resolve the name without the domain. I fixed it by adding the server to /etc/hosts, which is probably what I should have done first Cheers though :) S Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 27, 2006 Report Share Posted July 27, 2006 Do you really need to use DHCP for this specific machine? I'd just allocate a static ip address, which would then mean I have control of everything, and don't have to worry about dhcp overwriting the /etc/resolv.conf. Quote Link to comment Share on other sites More sharing options...
coverup Posted July 27, 2006 Report Share Posted July 27, 2006 Do you really need to use DHCP for this specific machine? I'd just allocate a static ip address, which would then mean I have control of everything, and don't have to worry about dhcp overwriting the /etc/resolv.conf. I have a similar problem. The vpn config program overwrites /etc/resolv.conf file and the resulting file does not include the search line. How do I make it automatically appended to the file? I can't use static IP address with vpn. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 28, 2006 Report Share Posted July 28, 2006 In theory, the search domain isn't normally required, as it'll attempt to search whatever domain name here for nameserver references from what I know. In all honestly, no idea how you manage to get it picked up by DHCP unless the DHCP server is offering this information. Quote Link to comment Share on other sites More sharing options...
coverup Posted July 28, 2006 Report Share Posted July 28, 2006 In theory, the search domain isn't normally required, as it'll attempt to search whatever domain name here for nameserver references from what I know. In all honestly, no idea how you manage to get it picked up by DHCP unless the DHCP server is offering this information. Neither do I understand this... but the fact is that I can address computers on the net using thier IP addresses, but I can't resolve their names. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 28, 2006 Report Share Posted July 28, 2006 What you could do, which isn't too difficult - done myself, is create your own DNS server using bind. Put in all your machines in here, resolving their names to ip's. Then, use this DNS server by all machines. What you also do within this DNS server is configure an external lookup so that if it's not found within it's own config, it'll get the rest from your router or ISP depending on what you're using for normal DNS resolution. I can give you a couple of config files for DNS itself, and the internal lookups for your machines. Much easier than configuring a hosts file on each machine. Quote Link to comment Share on other sites More sharing options...
Qchem Posted July 28, 2006 Report Share Posted July 28, 2006 The best solution here is probably to lock the /etc/resolv.conf file to prevent dhcp from changing it. You can do this with chattr +i /etc/resolv.conf (remember to change it to include the correct dns servers first). If you need to change it in future, just chattr -i /etc/resolv.conf to unlock it. AFAIK, this only works on ext2 and ext3 filesystems, but ext3 is the Mandy default. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 28, 2006 Report Share Posted July 28, 2006 Yup, part of e2fsprogs, so ext2/3 only. [ian@europa ~]$ whereis chattr chattr: /usr/bin/chattr /usr/share/man/man1/chattr.1.bz2 [ian@europa ~]$ rpm -qf /usr/bin/chattr e2fsprogs-1.38-3.1.20060mdk otherwise, if not using this filesystem, we can do a quick install of DNS and configure it up for what you need to do. Quote Link to comment Share on other sites More sharing options...
coverup Posted July 29, 2006 Report Share Posted July 29, 2006 I can give you a couple of config files for DNS itself, and the internal lookups for your machines. Much easier than configuring a hosts file on each machine. Yes please, if you could please post an example that could be useful. Quote Link to comment Share on other sites More sharing options...
lavaeolus Posted July 29, 2006 Report Share Posted July 29, 2006 (edited) first you must install bind (that's the nameserver-daemon) on the computer that will act as nameserver later (you could put the nameserver on the computer that already has the dhcp-server running) you can install it with urpmi bind-9.3.1 (the version actually in mandriva 2006) in Mandriva Control Center/System/Services check if the service named is set to start at bootup the following setup is assuming your network has 192.168.1.0/255.255.255.0 as IP-range, your nameserver is called BigBoss with 192.168.1.10 as IP-Adress, your client-computer is called Client with 192.168.1.20 as IP-Adress and your domain will be called mydomain.home you will have to edit the file /etc/named.conf first, there you must define your zones: controls { inet 127.0.0.1 port 953 }; options { directory "/var/named"; pid-file "/var/named/named.pid"; allow-query { any; }; allow-transfer { any; }; }; zone "localhost" { type master; file "zone/db.localhost"; }; zone "0.0.127.in-addr.arpa" { type master; file "zone/db.127.0.0.1"; }; zone "." { type hint; file "zone/root.hints"; }; zone "1.168.192.in-addr.arpa" { type master; file "zone/db.1.168.192.hosts"; forwarders { }; }; zone "mydomain.home" { type master; file "zone/db.mydomain.home.hosts"; forwarders { }; }; then you need 4 zone files, they must be in /var/named/zone (there should be already a file with the name root.hints in there): they are for the forward and reverse lookups these should be the following four files: db.1.168.192.hosts $TTL 3D @ IN SOA BigBoss.mydomain.home. BigBoss.mydomain.home. ( 20051123; Serial 10800 ; Refresh 3600 ; Retry 604800; Expire 86400); Minimum TTL NS BigBoss.mydomain.home. 10 IN PTR BigBoss.mydomain.home. 20 IN PTR Client.mydomain.home. db.127.0.0.1 $TTL 3D @ IN SOA mydomain.home. root.mydomain.home. ( 20051120; Serial 28800 ; Refresh 7200 ; Retry 604800; Expire 86400); Minimum TTL NS BigBoss.mydomain.home. localhost IN A 127.0.0.1 db.localhost $TTL 3D @ IN SOA BigBoss.mydomain.home. root.BigBoss.mydomain.home. ( 20051120; Serial 8H; Refresh 2H; Retry 4W; Expire 1D); Minimum TTL NS BigBoss.mydomain.home. 1 IN PTR localhost. db.mydomain.home.hosts $TTL 3D @ IN SOA BigBoss.mydomain.home. root.BigBoss.mydomain.home. ( 20051123; Serial 8H ; Refresh 2H ; Retry 4W; Expire 1D); Minimum TTL IN NS BigBoss.mydomain.home. localhost A 127.0.0.1 dnsmaster IN CNAME BigBoss.mydomain.home. BigBoss.mydomain.home. IN A 192.168.1.10 Client.mydomain.home. IN A 192.168.1.20 this is basically a static setup, if you want a more dynamic you could use dynamic dns-updates, but that means that you have to reconfigure your dhcp-server too I hope there are no typos or omissions, since I took the parts from my somewhat more complex setup Edited July 29, 2006 by lavaeolus Quote Link to comment Share on other sites More sharing options...
coverup Posted July 30, 2006 Report Share Posted July 30, 2006 Many thanks, I will give it a try when I have a bit of spare time on my hands. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 30, 2006 Report Share Posted July 30, 2006 Also, under options there is a forward lookup command to look at external DNS sources too, I'll have to check my file when back at work and post this so you have this for any external DNS that's lot listed locally on your machine. Quote Link to comment Share on other sites More sharing options...
lavaeolus Posted July 30, 2006 Report Share Posted July 30, 2006 (edited) one thing to note: this setup was done by using the DNS-Wizard from the Mandriva drakwizard package (had done this out of curiosity and laziness), I think you would not need the db.localhost, but it does not hurt to have it either (seems Mandriva just wanted to be sure that the nameserver always finds itself :D ) afaik, you don't necessarily need the forward option with this setup, because for everything your nameserver doesn't know, he will ask the nameservers in root.hints Edited July 30, 2006 by lavaeolus Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.