GreenLake Administration
Operating System - HP-UX
1844060
Members
3042
Online
110227
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2008 10:19 PM
11-15-2008 10:19 PM
Script
Hi All,
I want to check netstat -rn output with /etc/r.config/netstat file. I want to check which route entry are missed in netstat file.
I want to check these steps in 50 servers
Could u help me to make a script for this?
Thanks
Sujith
I want to check netstat -rn output with /etc/r.config/netstat file. I want to check which route entry are missed in netstat file.
I want to check these steps in 50 servers
Could u help me to make a script for this?
Thanks
Sujith
"The most wasted day is that in which we have not laughed."
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2008 02:15 PM
11-16-2008 02:15 PM
Re: Script
Hey;
Intriguing little puzzle, so I thought I'd give it a try.
The attached script first identifies the local IP addresses, then loops through the output of a netstat -rn command. If the gateway IP address isn't one of the NIC ip addresses, it looks for it in /etc/rc.config.d/netconf. It reports either way, but that's easy to change. I also left in the 127.0.0.1 to show what it'll look like when it doesn't find a route. In the production run, those should be filtered out as well.
The output looks something like the following (with some obfuscation for privacy/security):
# ./scan_routes | perl -i -ple 's/135.3.\d+/135.3.XX/g'
127.0.0.1 127.0.0.1 NOT listed in /etc/rc.config.d/netconf
135.3.XX.49 135.3.XX.49 was found as a nic route
135.3.XX.115 135.3.XX.115 was found as a nic route
135.3.XX.125 135.3.XX.125 was found as a nic route
135.3.XX.0 135.3.XX.125 was found as a nic route
135.3.XX.0 135.3.XX.115 was found as a nic route
135.3.XX.0 135.3.XX.49 was found as a nic route
127.0.0.0 127.0.0.1 NOT listed in /etc/rc.config.d/netconf
As for running it on X number of hosts, make sure you have ssh set up correction using public key authentication (*LOTS* of references to that in these forums) then:
for h in $(cat file_w_hostname)
do
echo "### ${h} ###"
ssh ${h} /tmp/scan_networks
done
or something equally clever.
HTH;
Doug O'Leary
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Intriguing little puzzle, so I thought I'd give it a try.
The attached script first identifies the local IP addresses, then loops through the output of a netstat -rn command. If the gateway IP address isn't one of the NIC ip addresses, it looks for it in /etc/rc.config.d/netconf. It reports either way, but that's easy to change. I also left in the 127.0.0.1 to show what it'll look like when it doesn't find a route. In the production run, those should be filtered out as well.
The output looks something like the following (with some obfuscation for privacy/security):
# ./scan_routes | perl -i -ple 's/135.3.\d+/135.3.XX/g'
127.0.0.1 127.0.0.1 NOT listed in /etc/rc.config.d/netconf
135.3.XX.49 135.3.XX.49 was found as a nic route
135.3.XX.115 135.3.XX.115 was found as a nic route
135.3.XX.125 135.3.XX.125 was found as a nic route
135.3.XX.0 135.3.XX.125 was found as a nic route
135.3.XX.0 135.3.XX.115 was found as a nic route
135.3.XX.0 135.3.XX.49 was found as a nic route
127.0.0.0 127.0.0.1 NOT listed in /etc/rc.config.d/netconf
As for running it on X number of hosts, make sure you have ssh set up correction using public key authentication (*LOTS* of references to that in these forums) then:
for h in $(cat file_w_hostname)
do
echo "### ${h} ###"
ssh ${h} /tmp/scan_networks
done
or something equally clever.
HTH;
Doug O'Leary
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP