[maemo-developers] Detecting network route change, acting on changes

From: Matthew Smith matt at smiffytech.com
Date: Sat Apr 24 05:29:42 EEST 2010
Hi Folks

I have now had my N900 for just over a week - got it doing most of what
I want and behaving like just another one of my Debian boxes.

What I would like to be able to do is to detect when the network
connection/route changes from my home WLAN to any other network (another
WLAN or 3G.)

If there is some way of catching this event, I'd like to, on the basis
of which network I'm on, change my /etc/hosts.

Currently doing this manually, as connections to stuff in my LAN
requires different behaviour depending on whether I'm connecting from
inside or out.  (So my servers are on private IP addresses when I'm
home, connecting through a public IP address/NAT when away.)

Can anyone point me to a suitable technique/recipe to do this?  Ideally
I'd like to do what is required in shell or Perl as I have yet to get my
head around Python and lack the time to learn at present.



Matthew Smith
Smiffytech - Technology Consulting & Web Application Development
Business:      http://www.smiffytech.com/
Blog/personal: http://www.smiffysplace.com/
LinkedIn:      http://www.linkedin.com/in/smiffy
Skype:         msmiffy
Twitter:       @smiffy
More information about the maemo-developers mailing list