Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Whats the best way to find out whether I'm in my home network?



2007/10/25, Joshua B. <joshua@example.com>:
> Is there a command, suitable for use in a script, that efficiently
> checks whether the machine running it is presently inside a particular
> network?
>
> I'm trying to write a script that I can run on my notebook whether at
> home behind my router, away from home on a public network, or offline
> and have it respond differently in each case.  Specifically if I'm at
> home I want it to rsync to the server at 192.168.0.3 (or similar), but
> if I'm away from home have it rsync to mydomain.org and if I'm offline
> to do something else.
>
> I've considered using ifconfig to check my inet addr - but that could
> be coincidentally the same if I'm a member of another c-class network.
>  I've thought of just blindly attempting to rsync to 192.168.0.3 but
> that feels horribly wrong - and insecure.

You can setup a simple  echo server  on that server[1]. When you ping
the echo server, you make it dumping something unique.

HTH

[1] Google it. Quit easy done with Perl.

-- 
Best Regards,
Nguyen Hung Vu
vuhung16plus{remove}@example.com
An inquisitive look at Harajuku
http://www.flickr.com/photos/vuhung/sets/72157600109218238/


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links