Changing IP Settings Automatically Based on Location

2

I have an Ubuntu 10.04 and basically I would like to achieve this:

  1. When I am at home, switch the network to use static IP.
  2. When I am at the office, switch the network to use DHCP.

Is there a program to do this?

Or is this something that should go inside an init script where if it is weekend or weekday from 7 pm to 7 am, then consider it a home. If it is home, then use static IP.

Thanks for the advice.

Carmen

Posted 2011-12-05T18:38:30.593

Reputation: 313

Answers

4

Have you considered leaving your computer set to DHCP and binding your MAC to the desired IP address on your home network?

We do this for a number of devices across different branches. Their IP address "follows" them around regardless of the branch they're in.

dannymcc

Posted 2011-12-05T18:38:30.593

Reputation: 310

2

The first section of man interfaces describes exactly what you're looking for.

Also, check out /usr/share/doc/ifupdown/examples/network-interfaces.gz for examples and use cases.

dkaragasidis

Posted 2011-12-05T18:38:30.593

Reputation: