Monday, August 29, 2011

How to set a static routes in AIX

You can use the route command to set a static route. But this way you don't get it back after reboot. 
To make a route persistent you need to change inet0. First check which routes are already set: 

 # lsattr -El inet0 -a route
 route net,-hopcount,0,,0, Route True
 route net,-hopcount,,,,,,, Route True

These routes would be set with: 
 # chdev -l inet0 -a route=net,-hopcount,0,,0,
 # chdev -l inet0 -a route=net,-hopcount,,,,,,,

To remove these specific static routes: 
 # chdev -l inet0 -a delroute=net,-hopcount,0,,0,
 # chdev -l inet0 -a delroute=net,-hopcount,,,,,,,

In this route string is the netmask, the destination net, and the gateway. 
For hostroutes the keyword net has to be replaced with host.