# misconfigured dhcp?

## curmudgeon

The network actually has several wired (static ip) and wireless (dhcp) machines on it, but for simplicity:

There are two hosts - static and dynamic.

The hosts files (identical on both machines):

```

127.0.0.1       localhost.domain.local          localhost

192.168.0.2     static.domain.local             static

```

/etc/resolv.conf on the dhcp machine:

```

# Generated by resolvconf

search domain.local

nameserver 1.2.3.4

nameserver 5.6.7.8

```

The relevant part of /etc/nsswitch.conf (both machines):

```

hosts:       files dns

networks:    files dns

```

I am encountering two problems.

First, dynamic is not getting assigned the domain name (but static is):

```

$ hostname -f

hostname: Unknown host

$ hostname -a

hostname: Unknown host

$ hostname -d

hostname: Unknown host

$ hostname

dynamic

$ hostname -f

static.domain.local

```

Second (and more important) dynamic can't resolve static even though it is in the hosts file:

```

$ host static

Host static not found: 3(NXDOMAIN)

```

It seems to want to go the network dns even for localhost (which means something is very wrong):

```

$ nslookup 127.0.0.1

Server:         1.2.3.4

Address:        1.2.3.4#53

1.0.0.127.in-addr.arpa  name = localhost.

```

/etc/conf.d/net for static is quite basic (I don't even know where it is picking up the domain name from):

```

config_eth0=( "192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0" )

routes_eth0=("default via 192.168.0.1")

```

/etc/conf.d/net for dynamic is also relatively simple:

```

modules='wpa_supplicant'

config_wlan0='dhcp'

dhcp_wlan0_domain='nodns'

wpa_supplicant_wlan0='-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf'

```

I guess that leads me to my third question. /etc/resolv.conf keeps getting overwritten despite my attempt to prevent that with this ssid (called domain). Can someone explain why?

Thank you in advance for your assistance.

----------

## Hu

 *curmudgeon wrote:*   

> Second (and more important) dynamic can't resolve static even though it is in the hosts file:
> 
> ```
> $ host static
> 
> ...

 That is what host does.  If you do not want to contact the DNS server, do not use host.

 *curmudgeon wrote:*   

> 
> 
> ```
> config_eth0=( "192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0" )
> 
> ...

 This is baselayout-1 syntax.  You should update it to baselayout-2 syntax, which does not use arrays.  However, that is not likely to be the cause of the problem at hand.

----------

## curmudgeon

 *Hu wrote:*   

> That is what host does.  If you do not want to contact the DNS server, do not use host.

 

OK. Got that.

 *Hu wrote:*   

>  *curmudgeon wrote:*   
> 
> ```
> config_eth0=( "192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0" )
> 
> ...

 

Yes, that is not the problem because that is what I have on the static machines (which work fine).

I don't even see where the hostname command is picking up the domain name (and of course, why it is not picking it up on the dhcp machines).

----------

