To add a static route to a single IP address use

route add ipaddr gwaddr

Where ipaddr is the target IP address and gwaddr is the IP through which the communication should route.

To add a static route to a whole network use

route add -net ipaddr gwaddr

Note : It is better to do this via smitty tcpip as smit also adds the route to the ODM and therefore it doesn’t disappear when the server is rebooted.

Of course, you could always use the chdev command with inet0 too, the general syntax for a network route is:

chdev -l inet0 -a route=net,-hopcount,0,-netmask,[netmask],if,[if],,,,-static,[destination network ip],[local gateway]

Check routes added with:

lsattr -El inet0

About troyski

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation