Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: mailing an ip adress for remote Administration
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
nove
n00b
n00b


Joined: 01 Oct 2004
Posts: 20

PostPosted: Sat Jul 23, 2005 8:44 am    Post subject: HOWTO: mailing an ip adress for remote Administration Reply with quote

Case: You have an Customer who is far far away, and you dont thrust any ip forwarding services like dyn-dns or something like that.
But you want to know the actuall ip adress to connect to it via ssh for remote administration, so you need the ip.

Heres one simple solution:

emerge postfix or another mail-server

emerge mailx

make a runablescript:
Code:

!/bin/sh
# ppp0 is here the device connected to the internet but feel free to put any interface you want there
ifconfig ppp0 |grep addr > /tmp/ipstate
diff /tmp/ipstate /var/state/ip >/dev/null || (
cp /tmp/ipstate /var/state/ip
mail yourmailadress@whatever.wherever < /var/state/ip
logger "Sending IP update"
)


you can do this also from another Server or System behind your firewall

1.) you have to do several things with ssh---> look here : https://forums.gentoo.org/viewtopic-t-360673-highlight-sshkeygen.html

2.) modified script:
Code:

!/bin/sh
# ppp0 is here the device connected to the internet but feel free to put any interface you want there
ssh root@yourfirewall "ifconfig ppp0" |grep addr > /tmp/ipstate
diff /tmp/ipstate /var/state/ip >/dev/null || (
cp /tmp/ipstate /var/state/ip
mail  yourmailadress@whatever.wherever < /var/state/ip
logger "Sending IP update"
)


now put this script to /etc/ppp/ip-up/ or you can put this script into a cronjob or make a gift to your mother :D or whatever.

The script sends every time the ip changed an updated mail on a mail adress you want.

Have Fun.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum