Routing – Single DHCP Server for Multiple VLANs in Packet Tracer

dhcproutingvlan

I have a layer 2 switch, PC 1 connected to port 1 and PC 2 connected to port 2.

  • Port 1 is in VLAN 20
  • Port 2 is in VLAN 21

Can I use a single DHCP server without a router and give IP to both the PCs?

I don't want to route coz I don't want VLANs 20 and 21 to communicate, I need the networks to be isolated.

Best Answer

There are basically two ways to do this:

  • DHCP server in both VLANs -- either a server with a trunk port or a server with two physical ethernet ports. Make it serve addresses for both VLANs. (Make sure you don't enable on any routing.)
  • With DHCP forwarding -- if there is a suitable DHCP forwarder present, it can be configured to relay (at Layer 4) the DHCP requests and answers to a DHCP server on another network. DHCP forwarding is a standard feature of most routers (eg Cisco's ip helper dhcp), but this router doesn't have to route packets, or can have all traffic prohibited between the VLANs. Also host-based DHCP systems can relay (eg ISC's dhcrelay). With this setup, the actual DHCP server has to know how to deal with remote networks (Cisco's and ISC's both work fine for this.)
  • Hybrid obviously you could have DHCP relay from one VLAN to the other, which is just a hybrid of the two methods.

Single DHCP server in both networks, with two interfaces or with trunk.

  DHCPD                 DHCPD
   | |                    |
===1=2===1===2===      ===T===1===2===    (1,2,T = VLAN 20, 21, Trunk)
         |   |                |   |
        PC1 PC2              PC1 PC2

With DHCP relays in each network, forwarding to a DHCP server elsewhere. (Could be on adjacent LAN, across the corporate network, or, unwisely, across the internet.)

   DHCPD
   |   |        
  REL1 REL2
   |   |                    
===1===2===1===2===
           |   |    
          PC1 PC2     

In a real network, you might think about starting from a point like this, where there's a control LAN for multiple redundant DHCP servers, LDAP etc, connected by router to the VLANs. This router would have DHCP relaying enabled, and control traffic between the VLANs and the internet. In reality it might well be multiple routers with some hot standby mechanism (HSRP, VRRP etc)>

 internet
    |
    R   DHCP1 DHCP2
   / \    |     |
  |  =+===+=====+===
  |
 =T===1===2===3===
      |   |   |