AIX routing - How Do I Compare ODM with the Current Routing Table?

I'm new to AIX, but not to UNIX in general. My Solaris and IRIX get rustier with each passing day. I've been using RHEL for the last several years, though.

My task it to write a shell script that compares the current routing table, from netstat -rn, with the ODM. There have been occasions where a new route was manually added, but not to the ODM. Weeks later the system is rebooted and the required route is missing. I want to periodically and automatically (think cron) run my script and report back to my group if there is a difference.

Is there an existing AIX tool to do this non-interactively, a smitty command perhaps? I'd love to use it. If not, how does AIX build the routing table at boot time? Can I examine that process to discover how it works?

Since the system has to read the ODM to build the routing table, I am considering using the output of lsattr -El inet0 -a route -F value or odmget -q "name=inet0" CuAt to build my own table and compare with the current routing table, but I do not know how to properly parse the output from those two commands. (Or even if those commands are general enough to find all the routes.) I found chginet Method which states the value of the route attribute is

route = type, [args,], destination, gateway, [metric]

I do not understand how this matches up with output such as this. (I've changed the IPs, but not the other values. Remember I just want to understand the layout of the data and how it builds a routing table, not to verify correctness.)

  1. net,-hopcount,0,,0,10.20.225.1
  2. net,,0,10.22.226.5
  3. host,-hopcount,0,,-if,en1,,,,-static,172.16.25.40,10.22.160.5
  4. net,10.20.226.0,-netmask,255.255.254.0,10.20.225.1
  5. net,-hopcount,0,-netmask,255.255.255.0,,,10.19.215.0,10.22.160.5
  6. net,-hopcount,0,-netmask,255.255.192.0,,,,,10.22.125.0,10.22.160.5

 

It is obvious that type = net|host but then how do I determine when the [args,], ends and destination begins? If I should be looking for ,, I've got way too many commas.

Does someone have an explanation that goes into more detail than the link at chginet Method? Some document or decision tree that would tell me something like if arg is -if or -netmask then you should expect this many more fields.

If I'm following the wrong path to solve my task, please point me in the right direction. I am not a PERL user, so I will not be able to maintain any PERL code. I am pretty darn good with the Bourne and Korn shells. My AIX systems do not have BASH installed. But I can write the code. I just need an understanding of what to look for.

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
AIX Health Check basic
Viewed 3828 times since Fri, Jun 8, 2018
How to set Kernel Parameters in AIX ?
Viewed 14203 times since Tue, Jul 2, 2019
AIX- Procedure to replace rootvg harddisk
Viewed 4078 times since Tue, Apr 16, 2019
Many Choices for AIX File Integrity
Viewed 2474 times since Wed, May 30, 2018
Installing a Interim Fix (APAR IV16587)
Viewed 2685 times since Tue, Jul 17, 2018
How to start daemons at the system startup in AIX servers
Viewed 2181 times since Tue, Jun 18, 2019
AIX↑ AIX www links
Viewed 3408 times since Sat, Apr 20, 2019
How to build a NIM Server on AIX 6.1 from the Scratch :: Part 1
Viewed 4549 times since Thu, Nov 29, 2018
AIX, System Admin↑ The chrctcp command
Viewed 2841 times since Fri, Apr 19, 2019
Part 1, The basics of network troubleshooting
Viewed 4971 times since Tue, May 22, 2018