Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Mike Pennington, dunxd, RobM, Ward, Shane Madden Jul 31 '12 at 4:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Is the ubuntu box the router for these subnets? Is the DHCP server on this ubuntu box? If not, what is acting as the router, and what is acting as the DHCP server? –  Mike Pennington Jul 30 '12 at 14:53
    
The dhcp server and router are different.dhcp server is another ubuntu machine . –  nachi Jul 30 '12 at 15:05
    
what is your router? Juniper? Something else that you tell us?? :-) –  Mike Pennington Jul 30 '12 at 15:31

3 Answers 3

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.

share|improve this answer
    
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

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 ?

share|improve this answer

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.