Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Bash script to domain lookup and change ACL

Posted on 2014-09-20
6
Medium Priority
?
181 Views
Last Modified: 2014-11-21
Hi,

I need to write a bash script to lookup a DNS name, let's say domain.dyndns.org, then compare it to a value in a file, if different update the file, then execute another script to ssh into a router and update an acl.

The purpose of this is to overcome a dynamic ip issue. I would want to run the script every 2 min or so.

Thanks
Mark
0
Comment
Question by:mark_06
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Paul S
ID: 40334990
have you tried a google search yet?

Here is what I found on google:

name lookup part:

do nslookup www.domain.com | grep Name | awk '{print $2}'; nslookup www.domain.com | grep Add | grep -v '#' | awk '{print $2}'; done

ssh part:
How to ssh from within a bash script? - Stack Overflow
http://stackoverflow.com/questions/1895185/how-to-ssh-from-within-a-bash-script

you'll have to modify as needed. we don't know how to modify your ACL since you have no info about it.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40335032
Why dont you plug it locally on router which in turn knows immediately when DHCP IP changed.
0
 
LVL 6

Author Comment

by:mark_06
ID: 40335135
What I am looking to do is export the IP address value into a file or database which it will then compare to the record. If it is the same IP as in the record, it will end. If the IP changed then it will execute another script.

I can't do it locally on the router as the Cisco IOS for a 2800 will not do it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 62

Expert Comment

by:gheist
ID: 40335136
Sounds absurd. How would you handle geographically distributed server pools?
Well 2 servers...
And you do dynamic DNS registration, but cannot send SNMP trap.
0
 
LVL 6

Author Comment

by:mark_06
ID: 40335168
I know it is absurd and very strange, however I do not need to worry about geographically distributed servers as the purpose is to allow 2 remote DSL connections with Dynamic IP's access to the corporate network (they don't want VPN) for VoIP. It's a crazy idea, however its more of a Proof of Concept rather than something that will be implemented on a wide scale.
0
 
LVL 62

Accepted Solution

by:
gheist earned 2000 total points
ID: 40335178
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month5 days, 18 hours left to enroll

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question