[ltp] automatic network probing

James Knott linux-thinkpad@linux-thinkpad.org
Sat, 22 Nov 2003 08:52:02 -0500


André Wyrwa wrote:
>>Stupid question:  Is there any way you can run DHCP at home and work? 
>>Then you're always asking for the IP, and you only have one config, and
>>you don't technically care which net you're on.  If you always want the
>>same IP, you can configure DHCP to recognize your MAC address.
> 
> 
> Yes, that would be an option - if my fli4l wouldn't have refused to boot
> the last time i tried to setup a dhcp server on it. I think i could dig
> into that and make it work some day, but thats not the point.
> 
> I'm interested for curiosity in a solution that would be open and
> flexible enough for easy future extension. Like being able to connect to
> any future network and setup the notebook correctly as soon as i know
> something about the networks structure.
> 
> The solution i'm looking for also has the purpose to make some more
> things possible, not just only the network to work, but you could create
> whole system profiles depending on the network which you are connected
> to.

Actually there is something you can do.  You can configure a static 
address for at home and then start dhcp when elsewhere.  If you want to 
automate it, you can try something I used with my wireless interface.  I 
have to configure my VPN differently, according to whether I'm accessing 
my my network via my wireless router or elsewhere.  What I do, is when I 
start up wlan on my notebook, it pings my wireless router IP.  If the 
correct MAC is returned, my VPN is configured for use at home (my 
wireless router is outside my firewall) using the IP of the wireless 
router.  If elsewhere, it's configured to access my public IP address.
You could do something similar, to determine if you want to run dhcp.

Check the -w & -c options for ping.