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.
| | |
===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.)
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)>
R DHCP1 DHCP2
/ \ | |
| | |