# Retrieve DNS Name from Host in LAN

## elomaniak

Hi folks, I am having a little problem.

i have a small PXE setup running here where the host has a ramdisk stored and the clients download this ramdisk during boot and boot this ramdisk into the ram and runs fine.

I would like to have the following situation.

the clients should get their dnsname from the server and display it instead of localhost

/etc/hosts

```
# IPv4 and IPv6 localhost aliases

127.0.0.1       localhost

::1             localhost

192.168.0.2     node1

192.168.0.3     node2

```

resolv.conf from client

```
nameserver 192.168.0.1
```

what do i have to do to achieve this?

dnsmasq.conf is enabled on eth3, which is the network card running with DHCPD and this is the network for the LAN, eth2 is connected to the internet.

if you need any more files, please let me know

thanks in avance

----------

## olek

(1) Is your dnsmasq-service running?

(2) I presume 192.168.0.1 is the address of your dnsmasq-server?

(3) What is the resolv.conf of the dnsmasq-server?

(4) Is your dnsmasq-server reachable at port 53 (UDP)?

Here are my bits of /etc/dnsmasq.conf which might be of concern:

```

#port= # so it listens on the fefault port 53

# Never forward plain names (without a dot or domain part)

domain-needed

# Never forward addresses in the non-routed address spaces.

bogus-priv

# Add local-only domains here, queries in these domains are answered

# from /etc/hosts or DHCP only.

local=/YOURLOCALNETSNAME/
```

----------

## Hu

Clients display their hostname.  If no other hostname is set, they may call themselves localhost.  Configure your DHCP client to respect the hostname set by the DHCP server.

----------

## elomaniak

 *Quote:*   

> (1) Is your dnsmasq-service running?

 

Yes it is running at boot

[quote](2) I presume 192.168.0.1 is the address of your dnsmasq-server?[quote]

Yes this is the servers IP

 *Quote:*   

> (3) What is the resolv.conf of the dnsmasq-server?

 

```
# Generated by dhcpcd from eth2

# /etc/resolv.conf.head can replace this line

domain *****.uni-frankfurt.de

nameserver ***.***.248.1

nameserver ***.***.246.1

# /etc/resolv.conf.tail can replace this line

```

eth3 is supposed to be the network for the pxe boot

 *Quote:*   

> (4) Is your dnsmasq-server reachable at port 53 (UDP)?

 

How can I check this?

 *Quote:*   

> Here are my bits of /etc/dnsmasq.conf which might be of concern:
> 
> ```
> 
> #port= # so it listens on the fefault port 53
> ...

 

----------

## dbishop

You might try dhcpdump on your host to make sure everything is in the dhcp exchange that you think should be there. (net-analyzer/dhcpdump-1.8, as of today, but you'll need to keyword it though) 

```

dhcpdump <-i interface> [-h macaddress]

```

Technically you can do this with tcpdump or wireshark, but I have found that for DHCP issues, dhcpdump is perfect.

To see if your DNS server is reachable, you can use something like nslookup and specify the server IP.  Here's how I do it on my network (although I use bind, not dnsmasq)

```
bbking ~ # nslookup google.com 172.16.3.1

Server:         172.16.3.1

Address:        172.16.3.1#53

Non-authoritative answer:

Name:   google.com

Address: 74.125.228.105
```

Alternatively you can use tcpdump on your host like this:

```
tcpdump -i eth3 port 53 and host 192.168.0.1
```

You can use the IP of host machine or the one that is pxe-booting. Hopefully these suggestions will help you see what is going on.

----------

## olek

Are the clients getting the names inside your servers /etc/hosts over dns?

----------

