Get notified when public facing IP changes
Posted: 14 Feb 2019 13:12
Good afternoon all,
I am stuck on this and need help! Please keep in mind that I am tech savy, but I am new to the scripting world so please have some patience with me. I will try to explain exactly what I am trying to do to the best of my ability.
I currently have a network that has my primary network and my secondary network in case my primary goes down, it will switch to my secondary. I would like to know if someone can help me set up a script to do nothing when the primary public ip is captured but to send me a email to my gmail account if it catches the secondary network.
I was doing some research and found the following:
If I open up CMD and type the following, it will show me what the public facing IP is on the command prompt. The command is this:
nslookup -debug myip.opendns.com. resolver1.opendns.com 2>NUL |findstr /C:"internet address"
If I go to the web and type the following website, it gives me the current public facing IP:
http://myip.dnsomatic.com/
So here is the scenario:
Public Facing IP 1: 111.111.111.111
Public Facing IP 2: 222.222.222.222
Here is what i need the script to do:
If 111.111.111.111 = 111.111.111.111
Then do nothing
Else send email to email@gmail.com saying your IP has been changed and is currently 222.222.222.222
I also do not have a exchange server. Please let me know if this is possible and can be done. I appreciate any help anyone has to offer and if there is more information or if I was not clear about something, please let me know and I will try my best to answer it correctly.
Thank you!
I am stuck on this and need help! Please keep in mind that I am tech savy, but I am new to the scripting world so please have some patience with me. I will try to explain exactly what I am trying to do to the best of my ability.
I currently have a network that has my primary network and my secondary network in case my primary goes down, it will switch to my secondary. I would like to know if someone can help me set up a script to do nothing when the primary public ip is captured but to send me a email to my gmail account if it catches the secondary network.
I was doing some research and found the following:
If I open up CMD and type the following, it will show me what the public facing IP is on the command prompt. The command is this:
nslookup -debug myip.opendns.com. resolver1.opendns.com 2>NUL |findstr /C:"internet address"
If I go to the web and type the following website, it gives me the current public facing IP:
http://myip.dnsomatic.com/
So here is the scenario:
Public Facing IP 1: 111.111.111.111
Public Facing IP 2: 222.222.222.222
Here is what i need the script to do:
If 111.111.111.111 = 111.111.111.111
Then do nothing
Else send email to email@gmail.com saying your IP has been changed and is currently 222.222.222.222
I also do not have a exchange server. Please let me know if this is possible and can be done. I appreciate any help anyone has to offer and if there is more information or if I was not clear about something, please let me know and I will try my best to answer it correctly.
Thank you!