I have servers connected to multiple Juniper EX4200 based virtual chassis. In order to make them hot swappable without manual reconfiguration, I would like to be able to always give the same IP, with DHCP, to servers connected to a specific switch port.

Or, alternatively, to be able for the server to know which port it has been connected to.

Is any of these setups possible?



Cisco switches offer a feature called "DHCP Server Port-Based Address Allocation", which implements DHCP option 82 (aka "DHCP Relay Agent Information"); in the general case, you should just need a switch which supports DHCP Option 82 and a DHCP server which knows what to do with that information. I don't know the specifics of your switch or DHCP server though.


That's backwards. DHCP has no knowledge of switch-ports. How is that supposed to work ?

You can give out a fixed ip to a specific mac-address by DHCP (a so-called DHCP reservation) but that requires that whatever swap you make preserves the mac-address.

As I have no knowledge of this Juniper equipment I have no idea if this is possible in your case.

Virtual machines typically have either a static mac-address that moves with the VM to whatever physical hardware which is hosting it. Or they have a dynamically generated mac-address that can change when you move it to different hardware. The static one is what you would need.

  • 1
    It's entirely possible with DHCP relay agent information, if the switch supports it. – Andrew Jan 17 '12 at 0:44

As Andrew mentioned many switches (including your Juniper EX4200 assuming they are running Junos >=9.3R2) support DHCP Option 82. When a client device sends a DHCP request to the DHCP server the switch injects additional information ("Relay Agent Information") specifying the port the request originated from ("circuit ID"). Many DHCP servers can be configured to use this information to always assign the same IP address to the devices on a specific port. This can also be used to prevent some spoofing attacks. See RFC 3046 for more information.


The only way I can think of to do this is to put each port in its own VLAN and subnet. Then for that subnet, configure a DHCP pool with only a single IP address.

  • Grin.. I hadn't thought of that one. It would work but (shudder) I would not want to be the one to maintain the documentation for that particular data-center. – Tonny Jan 16 '12 at 22:38
  • @Tonny - agreed. It's an ugly hack, but should theoretically work. – EEAA Jan 16 '12 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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