[nSLUG] hostname, /etc/hosts, DHCP

Doug McComber doug.mccomber at gmail.com
Sat Feb 24 07:26:10 AST 2007


Hi Oliver,

Basically what is happening is the DHCP server (your router) is
assigning your laptop it's hostname and domainname.  DHCP client on
your laptop is accepting that hostname and domainname, /etc/hosts be
damned!

To change this behaviour so that your laptop uses the values it
specifies you need to edit the DHCP client script for each interface
so that it tells the DHCP server that it already has a hostname and
domainname thank you very much, keep yours.  I can't remember the
specific files for this in Debian but you will find them somewhere in
the heirarchy of /etc/sysconfig.  And the value you need to modify or
add is something like:

DHCP_HOSTNAME=myhostname.mydomain

Or something similar (anyone know the syntax for sure).  Once you've
done this your /etc/hosts file is still valid, but just for looking up
ip address (which is it's purpose).

Hope that helps.

Doug

On 2/23/07, Oliver Doepner <odoepner at gmail.com> wrote:
> Hi,
>
> I want to understand how local hostname, /etc/hosts and DHCP/DNS on a
> wireless router all fit together.
>
> I run Kubuntu on a Laptop. Internet access is through Eastlink using a
> Wireless router with DD-WRT installed on it. The router's local address
> is 192.168.1.1.
>
> I sometimes connect my laptop using the wireless interface (wlan0),
> sometimes over ethernet (eth0). I have setup static DHCP leases on the
> router so that wlan0 is always 192.168.1.30 with hostname
> "satellite-wlan0" in the routers DNS and eth0 always gets 192.168.1.20
> and hostname "satellite-eth0".
>
> The (local) hostname of the laptop is "satellite", /etc/hosts consists
> of one line (except for ipv6 stuff):
>
> 127.0.0.1 localhost.localdomain localhost satellite
>
> I haven't touched the file. It was setup by the Kubuntu installer, I guess.
>
> The /etc/resolv.conf looks like this:
>
> domain odoepner.net
> nameserver 192.168.1.1
>
> When I was asked for a local domain during the installation I entered
> "odoepner.net", just for fun. I have also specified that same domain for
> the local network in the router configuration.
>
> But I don't know if that makes sense at all. For example if I do "host
> satellite" I get a "Host satellite not found: 3(NXDOMAIN)".
>
> When I am online over wlan0 then "host satellite-wlan0" yields
> "satellite-wlan0.odoepner.net has address 192.168.1.30".
>
> It seems that my local hostname has no meaning at all.
>
> Anyways, I am quite tired now. Maybe someone can make some enlightening
> comments on how things are done right in my scenario.
>
> cheers
> Oliver
>
> --
> Oliver Doepner
> http://users.eastlink.ca/~odoepner/
>
>
>
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug
>
> 
>
>

!DSPAM:45e0223e249932069121049!




More information about the nSLUG mailing list