Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

Network troubles on Linux DHCP client

I have a slackware64 14.1 Linux host which acts as Samba4 DC/AD and is the domain DNS. I am using the Linux bind v. 9.9.5, not the bind built into Samba4. The Windows workstation DHCP clients work just fine.

I am having problems with a troublesome Slackware 14.1 client. I believe I have found the culprit, but first the problems:

1. `hostname -f` just returns the hostname, not the FDQN.

2. `host hplaptop` (a domain workstation) returns:
$ host hplaptop
Host hplaptop not found: 3(NXDOMAIN)

Open in new window


Config files are:

/etc/hosts:
127.0.0.1               localhost
127.0.0.1               viao.hprs.local

/etc/HOSTNAME:
viao.hprs.local

/etc/resolv.conf:
# Generated by dhcpcd from wlan0, eth1
# /etc/resolv.conf.head can replace this line
domain hprs.local
nameserver 192.168.1.1
nameserver 192.168.0.2
# /etc/resolv.conf.tail can replace this line

The culprit appears to be the 1st nameserver line in /etc/resolv.conf "nameserver 192.168.1.1". When I comment out this line in resolv.conf my problems go away.

The domain I care about is 192.168.0.0/24 and the DC/AD DNS is 192.168.0.2, as shown. However, the viao host also has a wireless card and its DHCP assigned IP is 192.168.1.154 (assigned from some wireless device in the building not associated with the hprs.local domain).

Therefore I conclude that the problem is that network resolution requests are going the to wireless nameserver which doesn't find the requested host(s). Even when I leave 192.168.1.1 uncommented but move it *after* 192.168.0.2 things still work.

So, long description but here are the questions:

I thought if DNS lookup failed with one nameserver it would try the next. Why doesn't it try 192.168.0.2 when 192.168.1.1 returns "Host hplaptop not found: 3(NXDOMAIN)"?

Can I do anything to a) get it to look at all name servers? If not b) get the 192.168.1.1 nameserver listed 2nd? If not  c) not put 192.168.1.1 into /etc/resolv.conf at all (that file is auto-generated by dhcpd)?
Avatar of arnold
arnold
Flag of United States of America image

(AD) you should never use/reference external name servers when using local non-public domains,

Allow your installed DNS server to perform the lookups, you could define external forwarders within the DNS server if you wish to offload external lookups to .....

The failover to the second DNS server only occurs on a timeout event I.e. No response from the DNS server to which a request was sent.
Avatar of Mark
Mark

ASKER

(AD) you should never use/reference external name servers when using local non-public domains.

OK, but like I said, the /etc/resolv.conf file is created by dhcpc. So how to I prevent it from listing 192.168.1.1 first, or even prevent it from putting 192.168.1.1 into resolv.conf at all?
In the scenario you have where you are testing something else while using a laptop getting a wifi feed with auto-allocating IP as well as auto-assigned DNS settings, one way is to

one option as suggested in the /etc/resolv.conf
you can add content to
/etc/resolv.conf.head
that includes
domain hprs.local
search domain hprs.local
nameserver 192.168.0.2
nameserver 192.168.0.2

This will be prepended above the DHCPd set settings which may help in reducing the probability of this system ever hitting the 192.168.1.1 assigned with the wifi IP.

Another option, is to adjust the /etc/rc.d/rc.inet1.conf such that it has a set DNS server
NAMESERVER="192.168.0.2" might work in altering the resolv.conf. .....

Though you have to make sure once you are done with this test, to remove the NAMESERVER entry from the DHCPclient configuration of your wifi interface, or you will be unable to resolve
Avatar of Mark

ASKER

Hmmm, sure I could "hard-code" as you suggest or even set the resolv.conf to read-only. But these techniques somewhat defeat one of the purposes of DHCP. This client host is a laptop and as such doesn't always stay connected to this LAN. If it goes a-travelling, I'd have to make sure to undo these hand-changes.

I thought I read somewhere there was a way to prevent a dhcp client from making changes to resolv.conf, no?
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It could/should.
You might want to add -i to the grep just in case, the capitalization of any line items changes.
Avatar of Mark

ASKER

I figured out something that works