# [SOLVED] Resolving local names without specifying domain

## Kresp

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.

```

@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

```

```

user@host1 ~ $ cat /etc/conf.d/net

dns_domain_lo="lan"

dns_domain_enp30s0="lan"

config_enp30s0="dhcp"

```

Router configuration:

```

@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

```

```

@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

----------

## toralf

short term solution:

```

echo "search lan" >> /etc/resolv.conf

echo "domain lan" >> /etc/resolv.conf

```

long term:

put something like 

```
dns_search_eth0="zwiebeltoralf.de"
```

into /etc/conf.d/net. You have to replace "eth0" with your network adapters name.

----------

## Kresp

 *toralf wrote:*   

> 
> 
> ```
> dns_search_eth0="zwiebeltoralf.de"
> ```
> ...

 

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

```

option domain-name "lan";

option domain-search "lan", "isp.com";

```

Works like expected. Thanks.

----------

## toralf

great - now just put a "[solved]" into the title - thx  :Smile: 

----------

