Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a cut-down DHCP server implementation for a specific use-case. Rather than split off onto a private network for the development I'm running the server on a custom port (11167) and sending to a custom port (11168).

In order to test the system without needing access to the embedded client I'm using Ubuntu 11.04 running in Virtual Box.

I'm wondering how I can get dhclient on the Ubuntu box to talk to port 11167 and receive on port 11168.

share|improve this question
up vote 1 down vote accepted

From the dhclient(8) man page:

If the DHCP client should listen and transmit on a port other than the standard (port 68), the -p flag may used. It should be followed by the udp port number that dhclient should use. This is mostly useful for debugging purposes. If a different port is specified for the client to lis- ten on and transmit on, the client will also use a different destination port - one less than the specified port.

(Note this is from the isc-dhcp-client package in Debian squeeze. I don't know if your version of Ubuntu ships with a different dhclient package)

share|improve this answer
Thanks. Found this just after posting the quesion. Duh! The command: sudo dhclient -r releases any current address and stops the client. Then the command: sudo dhclient -p 11168 -d eth0 starts the client communicating with the server on port 11167 and keeps it in the foreground. Perfect! – Nick Jun 22 '11 at 9:25
PS. Can't seem to find a way of permanently changing the port using the dhclient.conf config file. – Nick Jun 22 '11 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .