Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dnsmasq - 1 DHCP server and multiple subnets
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Wed Apr 24, 2013 11:50 pm    Post subject: dnsmasq - 1 DHCP server and multiple subnets Reply with quote

I have a dnsmasq dhcp server. Working as dchp server for the subnet the host is on. However, there are other subnets connected via a Layer 3 switch. Using an ip helper address on the swtich I can point any dhcp request in other subnets to the dnsmasq server to get an ip.

Has anyone configured dnsmasq to hand out ips for multiple subnets? Id appreciate and example.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Tue Apr 30, 2013 6:31 am    Post subject: Reply with quote

I have done so, but only with dnsmasq installed on the router itself. The important thing is probably to clearly understand the use of the "set" and "tag" keywords. From the dnsmasq man page:
Quote:
The optional set:<tag> sets an alphanumeric label which marks this network so that dhcp options may be specified on a per-network basis. When it is prefixed with 'tag:' instead, then its meaning changes from setting a tag to matching it. Only one tag may be set, but more than one tag may be matched.


Here are some of the potentially interesting configuration items that I use. Keep in mind that my dnsmasq instance is on the router itself, with a physical interface to the WAN and a physical interface to each of two subnets, which I refer to as "lan" and "dmz". You don't want to copy this, but it should at least illustrate the use of the set and tag keywords to manage multiple subnets.
Code:
# If a name in /etc/hosts has multiple addresses, return the one
# in same subnet as the interface on which the query arrived
localise-queries

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=set:lan,192.168.0.15,192.168.0.30,24h
dhcp-range=set:dmz,192.168.1.15,192.168.1.30,12h

# Set the NTP time server address to be the same machine as
# is running dnsmasq
#dhcp-option=42,0.0.0.0
dhcp-option=tag:lan,42,192.168.0.1
dhcp-option=tag:dmz,42,192.168.1.1

# The following DHCP options set up dnsmasq in the same way as is specified
# for the ISC dhcpcd in
# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
# adapted for a typical dnsmasq installation where the host running
# dnsmasq is also the host running samba.
# you may want to uncomment some or all of them if you use
# Windows clients and Samba.
dhcp-option=19,0                    # option ip-forwarding off
dhcp-option=tag:lan,44,192.168.0.1  # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
dhcp-option=tag:dmz,44,192.168.1.1  # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
dhcp-option=tag:lan,45,192.168.0.1  # netbios datagram distribution server
dhcp-option=tag:dmz,45,192.168.1.1  # netbios datagram distribution server
dhcp-option=46,8                    # netbios node type

# Send microsoft-specific option to tell windows to release the DHCP lease
# when it shuts down. Note the "i" flag, to tell dnsmasq to send the
# value as a four-byte integer - that's what microsoft wants. See
# http://technet2.microsoft.com/WindowsServer/en/library/a70f1bb7-d2d4-49f0-96d6-4b7414ecfaae1033.mspx?mfr=true
#dhcp-option=vendor:MSFT,2,1i
# (I want this, but only for the dmz network (for guests))
dhcp-option=tag:dmz,vendor:MSFT,2,1i

_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum