Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
What do you mean by a "direct connection" to another PC? –  John Oct 18 '12 at 21:48
    
as in someone uses an ethernet cable with one end connected to my linux machine and the other to a PC. I'm assuming that Auto-MDIX will take care of the crossover-ness. –  richmb Oct 19 '12 at 14:21
1  
Having a DHCP server running on your machine to serve a local NAT that's routed to your WAN is not mutually exclusive with having your WAN interface obtain an IP from a downstream DHCP server. You can just use NetworkManager to turn on connection sharing (similar to Windows' ICS) and it'll do the appropriate routing rules, DNS, DHCP, etc. –  allquixotic Oct 19 '12 at 14:35
    
I think I'm going to enable dhcp fallback/auto-ip(avahi) on the linux machine and see how that works –  richmb Nov 5 '12 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.