Using AutoIP addressing while connecting between Virtual Machines

I once had to setup a test environment which established connectivity between two embedded Linux media streaming devices that were running inside virtual machines where both did not support DHCP for assigning their IP addresses and instead would utilize AutoIP for this purpose. This article explains how to setup this environment using one Linux VM within a Linux PC and another Linux VM within a Windows PC.

In this particular setup, both VMs and one VM host machine use Fedora 4 and the other VM host machine uses Windows XP.

Setup

The setup for this AutoIP test setup is shown below in Figure 1. Make sure that the network is on a private LAN and that there are no DHCP servers on the same network, including within your virtual machine. It may be possible that a DHCP server might be running on another interface, so make sure to have only one active connection per PC just to remove all doubts.

To verify that there is no “rogue” DHCP server on your network, enable DHCP on PC#2 by typing ‘dhclient’. This will broadcast DHCP requests on the network. If any DHCP servers exist, they will respond with DHCP OFFER messages. The end result will be an IP address assigned that is different than an AutoIP IP address of 169.254.x.x. Scanning for DHCP messages via Wireshark/Ethereal is another option.

Configuration

  1. Since Windows XP does not support AutoIP, a static IP address in the subdomain 169.254/16 must be used since this is the range that AutoIP uses. In Figure #1 above, it is 169.254.1.1. In order to get AutoIP to automatically allocate an IP address, PC#2 only requires that the host system on PC#1 has a valid AutoIp address. At this point, it doesn’t matter if PC#1’s Linux VM is running dhclient or not.
  2. Search for (ps -ef | grep dhclient) and disable the DHCP task on PC#2.
  3. The AutoIP functionality in Fedora Linux is part of a package called ‘Howl’ which contains a network interface daemon called ‘nifd’ and an autoIP daemon called ‘autoipd’. Run the nifd daemon by typing ‘nifd –n’.
    • nifd is used to monitor, via a configurable polling interval, the network interfaces on a host and signal autoipd when there is an IP address or link status change.
    • autoipd is the AutoIP daemon that needs to be running on PC#2.
  4. If nifd does not automatically run autoipd and subsequently does not allocate a 169.254.x.x ip address on PC#2 at this point, then toggle PC#2’s interface via ifconfig or ‘/etc/init.d/network restart’. Then delete the dhclient task (if started by nifd) and then run autoipd manually if it is not started already.
  5. At this point, if autoipd still has not allocated an IP address, then instrument some echo statements to these files to ensure they are running as expected.
    • /etc/sysconfig/network-scripts/ifup-eth
    • /sbin/dhclient-script (or whatever script is listed in /etc/dhclient.conf, if it exists)
  6. If autoipd on PC#2 has allocated a 169.254.x.x address, then disable dhclient and run nifd. Do the same sequence of steps from Step4 and Step5 above, but for PC#1 instead. Also, periodically make sure that dhclient has not started again.
  7. Hopefully at this point AutoIP is working on PC#1 and PC#2. If it is not, then the ifdown/ifup scripts that are run by nifd to automatically run either autoipd or dhclient may need to modified so that the dhclient daemon is not called.

References

Dynamic Configuration of IPv4 Link-Local Addresses

http://tools.ietf.org/html/rfc3927

Scroll to Top