Mailing List Archive


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

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



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.

I'm asking TLUG rather than elsewhere because I've shared drinks with
some of you and because I'm acting under the assumption that my
question is so elementary it could be answered by almost anyone who
knows more than me, (which should include all of you).  If it really
is that simple I'd be completely satisfied with a terse but polite
reference to a command. I'll be happy to ask Google or the man-pages
for the details.

Thank you kindly,

Joshua Bearden


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links