I want to configure a linux(ubuntu) machine such that when a direct connection is made with another PC my machine will enable a DHCP server and serve it an IP address, but if my machine is connected to a network with an existing DHCP server I want make sure my DHCP server is disabled and obtain an IP-address from the networks DHCP server.
If there are any better ways to manage the direct connection than having my own dhcp server, great. The only thing is that I do not want to use static IP addresses or force the external computer to use a static IP addresses.
So heres the two situations:
1. Us DHCP to serve an address to the PC
Linux box ------------- PC
2. Obtain an address automatically from the network
Linux box ------------- network
I want to automatically do the appropriate thing depending on what my machine gets connected to.