Starting linux with TCP/IP in listen only mode?

I am trying to emulate how a particular device works. What I need to do is have a linux box start up without a TCP/IP address, but still be able to listen on the ethernet network. A UDP broadcast message is transmitted on the network, which the linux box needs to be able to receive. One of the things in this UDP packet is the TCP/IP address that the linux box should use, so once I receive this packet I can reconfigure the ethernet interfaces to use that address. But, I need to be able to receive the packet before I do anything.

I can’t just start up with a default TCP/IP address, because I will possibly end up conflicting with a TCP/IP address already existing on the network.

Any ideas?

Hmm. UDP also runs over IP, so I don’t know if it’s even possible to receive a UDP packet, even in broadcast mode, without an actual IP address.

You could try putting the ethernet interface in promiscuous mode without configuring an IP and see what happens, though.

Maybe look at how DHCPC (DHCP Client) works. It manages to listen on the ethernet prior to an address being allocated. Of course, they are different sorts of packets, but still.

This code may be more helpful BootP Client and Server since it also uses unaddressed UDP packets, and may be a bit simpler.

What sort of device are you emulating? It sounds pretty odd - it’s not like DHCP for IP allocation is recent.

Si

I think I have it working.

It didn’t work without giving it an IP address, but on a whim I gave eth0 the loopback address and put it in promiscuous mode (ifconfig eth0 127.0.0.1 promisc) and it seems to work. Thanks for the push in the right direction.

The device I am emulating is a proprietary industrial controller running its own proprietary operating system. DHCP and BOOTP aren’t an option at this point.