Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-16-2014, 06:45 AM
|
#1
|
MLED Founder
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453
|
Replace dhcpd+bind by dnsmasq in a local network: few details
Hi,
In my local network (and on client's LANs), I'm using dhcpd and Bind to manage DHCP and DNS services. I've been reading some Dnsmasq documentation lately, and I think this would be a more simple solution, the more so since Dnsmasq is already shipping with a stock Slackware installation and its syntax seems more straightforward. I've experimented with it for a few hours, and first results are encouraging. There are a few configuration details that I have yet to solve.
Here's my current setup.
1. DHCP server:
Code:
# /etc/dhcpd.conf
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option broadcast-address 192.168.2.255;
option subnet-mask 255.255.255.0;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1;
option domain-name "microlinux.montpezat";
option domain-search "microlinux.montpezat";
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.100 192.168.2.200;
}
host alphamule {
hardware ethernet 00:1F:D0:AE:EC:FE;
fixed-address 192.168.2.2;
option host-name "alphamule";
}
host bernadette {
hardware ethernet 00:1D:09:15:4A:D8;
fixed-address 192.168.2.3;
option host-name "bernadette";
}
host raymonde {
hardware ethernet 00:1E:C9:43:A7:BF;
fixed-address 192.168.2.4;
option host-name "raymonde";
}
host amandine {
hardware ethernet 00:30:F1:6A:2F:40;
fixed-address 192.168.2.5;
option host-name "amandine";
}
host buzz-wired {
hardware ethernet 44:1E:A1:E6:FA:93;
fixed-address 192.168.2.6;
option host-name "buzz";
}
host buzz-wireless {
hardware ethernet E4:D5:3D:BD:EA:05;
fixed-address 192.168.2.6;
option host-name "buzz";
}
host bebette-wired {
hardware ethernet 00:27:19:F1:BC:3A;
fixed-address 192.168.2.7;
option host-name "bebette";
}
host bebette-wireless {
hardware ethernet 00:19:E0:83:3A:C1;
fixed-address 192.168.2.7;
option host-name "bebette";
}
host buildbox {
hardware ethernet 08:00:27:16:55:96;
fixed-address 192.168.2.8;
option host-name "buildbox";
}
2. Bind configuration:
Code:
// /etc/named.conf
options {
directory "/var/named";
query-source address * port 53;
forwarders {
// DNS 1 Nerim
// 195.5.209.150;
// DNS 2 Nerim
// 194.79.128.150;
// DNS 1 Google
8.8.8.8;
// DNS 2 Google
8.8.4.4;
};
};
//
// a caching only nameserver config
//
zone "." IN {
type hint;
file "named.root";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "microlinux.montpezat" {
type master;
file "/var/named/zone.microlinux.montpezat";
};
zone "2.168.192.in-addr.arpa" {
type master;
file "/var/named/revp.192.168.2";
};
Code:
; zone.microlinux.montpezat
$TTL 86400
$ORIGIN microlinux.montpezat.
@ IN SOA nestor.microlinux.montpezat. hostmaster.microlinux.montpezat. (
70 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS nestor.microlinux.montpezat.
IN MX 10 mail.microlinux.montpezat.
nestor IN A 192.168.2.1
alphamule IN A 192.168.2.2
bernadette IN A 192.168.2.3
raymonde IN A 192.168.2.4
amandine IN A 192.168.2.5
buzz IN A 192.168.2.6
bebette IN A 192.168.2.7
buildbox IN A 192.168.2.7
wireless-ap IN A 192.168.2.254
; Sites hébergés sur Nestor
mirror.nestor IN A 192.168.2.1
cmsms.nestor IN A 192.168.2.1
dan-services.nestor IN A 192.168.2.1
dolibarr.nestor IN A 192.168.2.1
fuckmicrosoft.nestor IN A 192.168.2.1
gepi.nestor IN A 192.168.2.1
kikinovak.nestor IN A 192.168.2.1
microlinux.nestor IN A 192.168.2.1
microlinux-2010.nestor IN A 192.168.2.1
microlinux-2011.nestor IN A 192.168.2.1
microlinux-2012.nestor IN A 192.168.2.1
microlinux-2013.nestor IN A 192.168.2.1
newscholae.nestor IN A 192.168.2.1
osteo.nestor IN A 192.168.2.1
osteo-montpellier.nestor IN A 192.168.2.1
osteo-sommieres.nestor IN A 192.168.2.1
phpinfo.nestor IN A 192.168.2.1
radionovak.nestor IN A 192.168.2.1
scholae.nestor IN A 192.168.2.1
scholaecms.nestor IN A 192.168.2.1
villa-figaret.nestor IN A 192.168.2.1
Code:
; revp.192.168.2
$ORIGIN 2.168.192.in-addr.arpa.
$TTL 86400
@ IN SOA nestor.microlinux.montpezat. hostmaster.microlinux.montpezat. (
70 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS nestor.microlinux.montpezat.
1 IN PTR nestor.microlinux.montpezat.
2 IN PTR alphamule.microlinux.montpezat.
3 IN PTR bernadette.microlinux.montpezat.
4 IN PTR raymonde.microlinux.montpezat.
5 IN PTR amandine.microlinux.montpezat.
6 IN PTR buzz.microlinux.montpezat.
7 IN PTR bebette.microlinux.montpezat.
8 IN PTR buildbox.microlinux.montpezat.
254 IN PTR wireless-ap.microlinux.montpezat.
Now here's what my Dnsmasq configuration looks like for the moment:
Code:
# /etc/dnsmasq.conf
domain-needed
bogus-priv
interface=eth1
dhcp-range=192.168.2.100,192.168.2.200,24h
local=/microlinux.montpezat/
domain=microlinux.montpezat
expand-hosts
server=8.8.8.8
server=8.8.4.4
dhcp-host=00:1F:D0:AE:EC:FE,alphamule,192.168.2.2
dhcp-host=00:1D:09:15:4A:D8,bernadette,192.168.2.3
dhcp-host=00:1E:C9:43:A7:BF,raymonde,192.168.2.4
dhcp-host=00:30:F1:6A:2F:40,amandine,192.168.2.5
dhcp-host=44:1E:A1:E6:FA:93,E4:D5:3D:BD:EA:05,buzz,192.168.2.6
dhcp-host=00:27:19:F1:BC:3A,00:19:E0:83:3A:C1,bebette,192.168.2.7
dhcp-host=08:00:27:16:55:96,buildbox,192.168.2.8
So far, the setup works as expected. Hostnames are managed centrally on the server, e. g. client machines don't have any hostname configuration in their /etc/HOSTNAME or /etc/hosts.
There's a few things I have yet to figure out. First things first. How do I add additional DNS entries like those in /var/named/zone.microlinux.montpezat?
Code:
mirror.nestor IN A 192.168.2.1
cmsms.nestor IN A 192.168.2.1
dan-services.nestor IN A 192.168.2.1
One other thing: as far as I can tell, dnsmasq works like dhcpd and bind, e. g. uses UDP port 67 as well as TCP and UDP port 53 for managing DHCP and DNS requests. Right?
Cheers,
Niki
Last edited by kikinovak; 03-16-2014 at 06:47 AM.
|
|
|
03-16-2014, 07:15 AM
|
#2
|
MLED Founder
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453
Original Poster
|
I try to answer the first question myself. After some more experimenting, I tried the following directive:
Code:
# /etc/dnsmasq.conf
...
address=/mirror.nestor/192.168.2.1
address=/cmsms.nestor/192.168.2.1
...
I don't know if this solution is orthodox, but so far, it seems to work.
Any suggestions, in general and in particular?
|
|
|
03-16-2014, 07:34 AM
|
#3
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Officially, your use of the "address" is incorrect - the "address" statement is used to mask a whole domain behind a single IP address. In your case, "mirror.nestor" is seen by dnsmasq as a domain name, not a host name. If you look up anything ending on "mirror.nestor", like one.mirror.nestor , foo.mirror.nestor but also just mirror.nestor, dnsmasq will return 192.168.2.1. Effectively, this does what you want.
The correct way of adding hosts is to write them into your server's /etc/hosts file.
Eric
|
|
2 members found this post helpful.
|
03-16-2014, 09:10 AM
|
#4
|
Member
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 642
|
The entries below are from my own home server conf file - they may be of some use to you ...
#dhcp-option= options from rfc2132
dhcp-option=1,255.255.255.0
dhcp-option=3,192.168.24.100 # router option, fix when this machine dials out
dhcp-option=4,192.168.24.100 # time server is option 4
dhcp-option=5,192.168.24.100 # name server is option 5
dhcp-option=6,192.168.24.100 # dns option
dhcp-option=19,0 # ip forwarding off
dhcp-option=42,192.168.24.100 # ntp server is option 42
dhcp-option=44,192.168.24.100 # netbios over tcp/ip name server
dhcp-option=45,192.168.24.100 # netbios over tcp/ip datagram distribution server option
dhcp-option=46,8 # netbios over tcp/ip node type option
dhcp-option=47 # netbios over tcp/ip scope option
dhcp-option=252,"\n" # Send an empty WPAD option. This may be REQUIRED to get windows 7 to behave.
|
|
1 members found this post helpful.
|
03-16-2014, 12:51 PM
|
#5
|
MLED Founder
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453
Original Poster
|
Quote:
Originally Posted by Alien Bob
Officially, your use of the "address" is incorrect - the "address" statement is used to mask a whole domain behind a single IP address. In your case, "mirror.nestor" is seen by dnsmasq as a domain name, not a host name. If you look up anything ending on "mirror.nestor", like one.mirror.nestor , foo.mirror.nestor but also just mirror.nestor, dnsmasq will return 192.168.2.1. Effectively, this does what you want.
The correct way of adding hosts is to write them into your server's /etc/hosts file.
Eric
|
I forgot to mention it, but I think you guessed it so far. The local server is also running a LAMP server, and all these mirror.nestor, cmsms.nestor etc. entries are so many Apache virtual hosts. So in other terms, it's sufficient to add them to the server's /etc/hosts... and then Dnsmasq takes care of "propagating" this information to the local network's clients?
Edit: looks like this works indeed as announced. Thanks very much, Eric!
Last edited by kikinovak; 03-16-2014 at 12:56 PM.
|
|
|
03-16-2014, 06:44 PM
|
#6
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,468
|
Quote:
dhcp-option=252,"\n" # Send an empty WPAD option. This may be REQUIRED to get windows 7 to behave
|
I just found this one recently. It stops annoying log spam from Windows 7 machines continually seeking a WPAD server.
|
|
|
All times are GMT -5. The time now is 10:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|