Re: [SLE] automaticaly send an IP change

From: Brad Bendily (brad_at_selu.edu)
Date: 06/14/05

  • Next message: suse_gasjr4wd_at_mac.com: "Re: [SLE] automatically send an IP change"
    Date: Tue, 14 Jun 2005 10:57:41 -0500 (CDT)
    To: suse-linux-e@suse.com
    
    

    > > Is there a script/package which can check the external IP on regular
    > > basis and send the changes to an email?
    >
    > Is the host name consistent? If so, you can just do a dns lookup. If
    > the host name changes with the IP, then that won't work. Another
    > possibility, is a dynamic dns server, which many firewall/routes can be
    > configured to use.

    Here's a script that I made that at first I ran every 12 hours at my
    house. Until I made the script below that runs hourly.
    Also worth noting is that this stuff is running on RedHat 7.x

    #!/bin/sh

    FILE2=`echo "/fwlog/ifconfig.txt"`

    touch /fwlog/ifconfig.txt
    ifconfig eth0 | grep inet | awk -F: '{print $2}' | sed 's/Bcast//' > /fwlog/ifconfig.txt
    mv -f /fwlog/ifconfig.txt $FILE2

    cat $FILE2 | mail -s"IP address, ifconfig" email@gmail.com

    I have another script that checks the ip and only sends an email if it's
    changed. This may be better for you. This runs hourly.

    #!/bin/sh

    ifconfig eth0 | grep inet | awk -F: '{print $2}' | sed 's/Bcast//' >
    /etc/fw/ipcheck

    I=`cat /etc/fw/ip`
    #IP2=`cat /etc/fw/ipcheck`
    P=`cat /etc/fw/ipcheck`

    #echo "My ip is $IP1"
    #echo "My ip is $IP2"

    if [ "$I" != "$P" ]; then
           /etc/./ipshow
           /etc/fw/./fw
           rm -rf /etc/fw/ip
           cp /etc/fw/ipcheck /etc/fw/ip

    #echo "My ip is $I"
    #echo "My ip is $P"

    #else
    #exit 0
    fi

    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: suse_gasjr4wd_at_mac.com: "Re: [SLE] automatically send an IP change"

    Relevant Pages

    • creating remoteuser
      ... Am not able to complete the script, plz tell me where i am going wrong... ... echo Checking for the user file ... while read USER GROUP PASSWORD FULL NAME ... #read -e HOST ...
      (RedHat)
    • Re: [SLE] automaticaly send an IP change
      ... >> Is the host name consistent? ... you can just do a dns lookup. ... >> the host name changes with the IP, ... Until I made the script below that runs hourly. ...
      (SuSE)
    • Re: [Full-disclosure] reduction of brute force login attempts via SSHthrough iptables --
      ... Anyhow its no problem at all to modify, so if you dont like it, just dont use it. ... on a lame script like this as long as it WORKS and is not insecure. ... echo "~ sorting out ip by ip" ... # echo "not enough failed logins, probably no attack from: ...
      (Full-Disclosure)
    • Ripping Tapes with Linux--How To
      ... the full script is located in the BASH ... My tape player is a portable style journalist's recorder from the ... The most irritating part of the recording process was setting the ... echo Starting de-noise procedure to file $TMP1 ...
      (comp.os.linux.misc)
    • Re: Linux Backup with Modification Date Filter?
      ... I wrote a bash script that acts as a wrapper to rsnapshot which first ... generates a modification-date filter, ...
      (comp.os.linux.misc)