6

Possible Duplicate:
Can I have multiple DHCP servers on one network?

This is a very old question i guess.In this forum itself it has been answered in Multiple VLANs, multiple subnets, single DHCP server?.That is done on using the Helper options of Cisco router. But in my case we are not using the Cisco router.

In my ubuntu machine i have set 3 VLANs with id's 3,4,5.I wanted to provide them with the IP addresses through dhcp server.But i have a doubt related to the concept as well as the implementation.Normally a dhcp server will be configured with one interface (say eth0 )with a particular IP address say of 192.168.0.100.So if a client requires IP, it will send dhcp requests to that server and the server also identifies that the request is from that subnetwork, and provides an appropriate IP from the same subnetwork.(say 192.168.0.20)

But if many VLAN interfaces are there and requesting for IP address, how the Server will differentiate that the dhcp request is from this particular VLAN and provide the IP from the corresponding subnetwork range.

I heard that we should create the VLANs on the dhcp-server.Can anyone please throw some light on method, the concept as well as the implementation?

nachi
  • 61
  • 1
  • 1
  • 2

3 Answers3

6

if your linux router has trunk interface to the switch with tagged vlans you can do it without problems.

first define each vlan in /etc/network/interfaces eg:

auto eth0.200
iface eth0.200 inet static
 address 10.0.1.1
 netmask 255.255.255.0


iface eth0.201 inet6 static
 address 10.0.2.1
 netmask 255.255.255.0


iface eth0.202 inet6 static
 address 10.0.3.1
 netmask 255.255.255.0

then tell dhcp daemon to listen on some/all of those subnets by editing /etc/default/isc-dhcp-server [or dhcpd] and changing variable INTERFACES to "eth0.200 eth0.201 eth0.202"

and adding separate subnets to /etc/dhcp/dhcpd.conf

subnet 10.0.1.0 netmask 255.255.255.0 {
  range 10.0.1.10 10.0.1.20;
  # you might point some other address 
  # within that subnet that should be advertised as router
  # it does not have to be your linux box
  option routers 10.0.1.1;
  option broadcast-address 10.0.1.255;
  authoritative;
}

and so on for the rest of subnets.

pQd
  • 29,561
  • 5
  • 64
  • 106
  • hi pQd,Does it mean that the server will be listening on all the interfaces simultaneously? And do i need to create the VLANs again on the server to provide the virtual interfaces for the server to listen? If i do so,then the server will be having 3 virtual static address,is that so? My questions may be silly, but i wish to get clarified. thanks – nachi Jul 30 '12 at 15:14
  • yes - it'll listen on all 3 [in my example] vlans. you create virtual interfaces just by adding the lines to /etc/netwrok/interfaces.. and.. you'll need to apt-get install vlan – pQd Jul 30 '12 at 15:17
1

To create multiple VLAN on your server, you will need a switch with 802.1q (VLAN Tagging or Trunk in Cisco terminology) enable or multiple physical interface. The DHCP server will listen requests on each interface. You can define the distributed addresses for each interface.

The clients are connected on one VLAN, the broadcast the IP request. Your server receive the request and then answer to the range defined for this VLAN.

Do you have a switch with 802.1q support ? Or do you have multiple interfaces on your server ?

Dom
  • 6,628
  • 1
  • 19
  • 24
  • This is not the only case: I have an AP wired to an interface on my server which broadcasts two SSIDs, and packets from each of the SSIDs are tagged with a different VLAN. – WoJ Sep 10 '16 at 13:57
  • Of course but the question was about a router, so no Wifi. – Dom Sep 10 '16 at 18:29
1

If you router is a Linux box, then you need to install a DHCP relay. The most common is the ISC package isc-dhcp-relay.

Once you install it you must give it a list of every interface that it will be relaying DHCP to and from, and you must provide the IP address of the DHCP server. The config file is /etc/default/isc-dhcp-relay.

The name of the package has changed once in the last couple years, so if you are running an older version of Ubuntu the package might be named different.

Zoredache
  • 128,755
  • 40
  • 271
  • 413