View previous topic :: View next topic |
Author |
Message |
Kresp Tux's lil' helper
Joined: 17 Oct 2016 Posts: 77
|
Posted: Sat Aug 12, 2017 1:13 pm Post subject: [SOLVED] Resolving local names without specifying domain |
|
|
I'm switching from dnsmasq to bind, and am almost done except for one little thing.
I setup up domain name "lan" and unique names for every machine.
I can resolve addresses using full names like "host1.lan".
However, since they are all supposed to be within same domain, I'd like to be able to resolve them by using just hostnames, so I can just ssh host1, ping host1, etc.
/bin/domainname is missing for some reason, but even if I symlink it to /bin/hostname, it just returns "(none)".
Even if I use domainname to set domain on every machine manually, nslookup fails with NXDOMAIN.
Code: |
@host1 ~ $ nslookup router.lan
Server: 192.168.100.1
Address: 192.168.100.1#53
Name: router.lan
Address: 192.168.100.1
@host1 ~ $ nslookup router
Server: 192.168.100.1
Address: 192.168.100.1#53
** server can't find router: NXDOMAIN
|
Code: |
user@host1 ~ $ cat /etc/conf.d/net
dns_domain_lo="lan"
dns_domain_enp30s0="lan"
config_enp30s0="dhcp"
|
Router configuration:
Code: |
@router ~ $ cat /var/bind/pri/lan.zone
$TTL 1W
@ IN SOA lan. root.lan. (
2017081210
28800
3600
604800
86400 )
IN NS router.lan.
router.lan. IN A 192.168.100.1
host1.lan. IN A 192.168.100.2
host2.lan. IN A 192.168.100.3
|
Code: |
@router ~ $ grep -v ^# < /etc/dhcp/dhcpd.conf
option domain-name-servers 192.168.100.1;
option subnet-mask 255.255.255.0;
option routers 192.168.100.1;
subnet 192.168.100.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.100.1;
option subnet-mask 255.255.255.0;
option routers 192.168.100.1;
range 192.168.100.100 192.168.100.200;
}
host host1 {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.100.2;
}
host host2 {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.100.3;
}
|
Also, it's a bit annoying that I have to duplicate declaration for every host, but I guess I can not get away from it while running separate applications for DNS and DHCP without something like LDAP.
Last edited by Kresp on Wed Aug 16, 2017 1:10 pm; edited 1 time in total |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Sat Aug 12, 2017 3:10 pm Post subject: |
|
|
short term solution: Code: |
echo "search lan" >> /etc/resolv.conf
echo "domain lan" >> /etc/resolv.conf
| long term:
put something like Code: | dns_search_eth0="zwiebeltoralf.de" | into /etc/conf.d/net. You have to replace "eth0" with your network adapters name. |
|
Back to top |
|
|
Kresp Tux's lil' helper
Joined: 17 Oct 2016 Posts: 77
|
Posted: Sun Aug 13, 2017 2:32 am Post subject: |
|
|
toralf wrote: |
Code: | dns_search_eth0="zwiebeltoralf.de" | into /etc/conf.d/net. You have to replace "eth0" with your network adapters name.
|
This seems like a client setting.
After looking up "domain search" option for resolv.conf, I added option domain-name "lan"; to my subnet in dhcpd.conf, but then it overrides my ISP's domain.
Ended up with
Code: |
option domain-name "lan";
option domain-search "lan", "isp.com";
|
Works like expected. Thanks. |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Sun Aug 13, 2017 9:26 am Post subject: |
|
|
great - now just put a "[solved]" into the title - thx |
|
Back to top |
|
|
|