Solved

Bash script to domain lookup and change ACL

Posted on 2014-09-20
6
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 500 total points
ID: 40335178
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

635 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