[Dnsmasq-discuss] setting up dynamic DNS?

Jan 'RedBully' Seiffert redbully at cc.fh-luh.de
Sun Sep 9 16:10:49 BST 2007


Adam Hardy wrote:
> Hi DNSmasq List
> 
> I have a small network with a slightly different setup for the internet
> broadband from usual. I'm having problems working out how to set up a
> DHCP service with dnsmasq to provide workstations with permanent host
> names.
> 
> Instead of the usual router providing DHCP and DNS services, I just have
> a simple DSL modem attached to eth2 on my gateway server (isengard).
> Using dhclient3, isengard grabs itself a public ip for eth2 via DHCP on
> the modem.
> 

Thats IMHO a typical setup, i also just use a dsl modem and a full-blown
linux box as router, because the config capabilities of those
router-in-a-box won't cut my needs (multihomed router, fancy traffic
shaping, some servers, etc.).

> isengard also runs dnsmasq on eth1 for the internal network, and I run
> iptables as my firewall to protect it. I gave eth1 the IP 192.168.0.2
> 
[snip]
> 
> I've reached the point where dnsmasq tells every client to use
> 192.168.0.2 as the nameserver. These clients run dhclient3 (and windows
> and the mac are happy too)
> 
> But this naive approach obviously doesn't cut the mustard. Can I
> instruct dnsmasq to be nameserver of all my hosts for each other?
> 

> isengard /etc/dnsmasq.conf:
>
> domain-needed
> bogus-priv
> filterwin2k
> dhcp-range=192.168.0.3,192.168.0.254,12h

If this is your complete dnsmasq.conf, you will need some more entries.

First, you need to set some dhcp-options, the client needs to requst
(but normaly does if everthing is set to "recive stuff over dhcp")

dhcp-option=1,255.255.255.0 # subnet mask
dhcp-option=3,0.0.0.0 # default gateway
dhcp-option=6,0.0.0.0 # dns-server

0.0.0.0 denotes the IP dnsmasq is listening to (in your case 192.168.0.2)
When your Samba comes in to play, you maybe also want
dhcp-option=44,0.0.0.0 # set WINS

Didn't you recieve a dnsmasq example config file?
(/usr/share/doc/dnsmasq* ?)

Second, to assign some hosts a permanent IP-address, even if recieved by
dhcp, you need some dchp-host lines
dhcp-host=mac-address,name,ip,leasetime
ex:
dhcp-host=01:23:45:67:89:AB,gondor,192.168.0.3,infinite

You may want to shorten your dynamic range to make room for those static
entries.

As soon as this lease is given to the client, you should be able to ping
it by name (if you have isengard as dns-server in your resolv.conf), and
if its switched off (lease returned) you should get 'host unknown' (this
is the nice part of dnsmasq beeing both, dns and dhcp server).

Finaly you may want to split the resolv.conf for the machine isengard,
and the dns servers dnsmasq uses (upstream).
Since i have to use PPPoE, i changed the DSL-Scripts not to overwrite
/etc/resolv.conf and said my dnsmasq to use the resolv.conf always
generated by pppd:
resolv-file=/etc/ppp/resolv.conf

and then set /etc/resolv.conf to
nameserver 127.0.0.1

But how to achive this depends on the way you connect to upstream.

HTH

> Thanks and regards
> Adam Hardy
> 

Greetings
	Jan

-- 
Ever notice how fast Windows runs? Neither did I.



More information about the Dnsmasq-discuss mailing list