Home:ALL Converter>How to make a dhcp server listen for broadcast requests in a virtual box vm

How to make a dhcp server listen for broadcast requests in a virtual box vm

Ask Time:2012-03-21T19:49:55         Author:fkl

Json Formatter

I am working on udhcpd, a light weight dhcp server that comes with busy box.

I have made some code changes and to test those i need to run udhcpd, send it request (to obtain ip) from a client and view its response.

This requires multiple machines and the suitable option for me was to use multiple virtual box VMs.

I used two linux VM's (Fedora for running udhcpd and a ubuntu for running udhcpc - a client that comes with busy box for generating dhcp requests).

Now there are multiple modes of networking in virutal box. I have tried them all. NAT the most simple allows vm to use my windows internet without any configuration.

I tried various types of virtual box cards i.e. host only, internal network and assigned a 192.168.0.1 address to fedora which is udhcpd and sent dhcp discover requests from udhcpc clients.

Both are on the same interface i.e. eth0 and i can see the broadcast request from 0.0.0.0 to 255.255.255.255 for dhcp discover. But udhcpd - the dhcp server, never receives and answers the request.

I also tried by assigning an ip to the dhcp client first i.e. 192.168.0.2.

But never get a response.

If i use NAT or another mode in which Virtual box own's dhcp server is running, then it is that server which responds to the dhcp discover and still my udhcpd from busy box does not pick the packets.

I feel it has something to do with the subnet mask may be of udhcpd server.

Any one has any idea?

Author:fkl,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/9804068/how-to-make-a-dhcp-server-listen-for-broadcast-requests-in-a-virtual-box-vm
yy