Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Resolving local names without specifying domain
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Kresp
n00b
n00b


Joined: 17 Oct 2016
Posts: 73

PostPosted: Sat Aug 12, 2017 1:13 pm    Post subject: [SOLVED] Resolving local names without specifying domain Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3647
Location: Hamburg

PostPosted: Sat Aug 12, 2017 3:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Kresp
n00b
n00b


Joined: 17 Oct 2016
Posts: 73

PostPosted: Sun Aug 13, 2017 2:32 am    Post subject: Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3647
Location: Hamburg

PostPosted: Sun Aug 13, 2017 9:26 am    Post subject: Reply with quote

great - now just put a "[solved]" into the title - thx :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum