AIXDeleteRoute

== How to delete routes under AIX ==

Please note that the {{{route}}} command is significantly different under AIX than under Linux or BSD.

These are quick notes, I hope you'll find them useful.

As usual, checking the man page of the route command is very important.

== The easy, but non-permanent way ==

This is on a machine that showed very slow performance when communicating with a financial information server:

==== 1. Check the existing routes ====

To do this, use the {{{netstat -r}}} command:

{{{ # netstat -r Routing tables Destination Gateway Flags Refs Use If Exp Groups

Route Tree for Protocol Family 2 (Internet): default 10.1.1.1 UG 2 317893 en4 - - 10.1.0.0 superman UHSb 0 0 en4 - - => 10.1/16 superman U 65 600213901 en4 - - apsysuk3 loopback UGHS 1616 2302646392 lo0 - - 10.1.255.255 superman UHSb 2 149868 en4 - - 10.200.200/24 10.1.200.90 UG 1 53612 en4 - - 10.254.212/24 10.1.200.90 UG 0 5424888 en4 - - 10.254.214/24 10.1.200.90 UG 0 8318252 en4 - - 10.254.218.135 10.1.200.10 UGHD 10 5224 en4 - - 10.254.218.136 10.1.200.10 UGHD 4 153185 en4 - - 10.254.218.137 10.1.200.10 UGHD 20 93007 en4 - - 10.254.218.138 10.1.200.10 UGHD 5 2534 en4 - - 10.254.218.139 10.1.200.10 UGHD 1 187 en4 - - 10.254.218.144 10.1.200.10 UGHD 9 8644 en4 - - 10.254.218.145 10.1.200.10 UGHD 11 1565 en4 - - 10.254.218.149 10.1.200.10 UGHD 9 32481 en4 - - 10.254.218.151 10.1.200.10 UGHD 1 40484 en4 - - 10.254.218.153 10.1.200.10 UGHD 11 12210 en4 - - 127/8 loopback U 28 6512915 lo0 - - fts.ftsinfo.com 10.1.1.4 UGH 0 5718331 en4 - - 146.246.6.200 10.1.1.4 UGH 0 0 en4 - - 192.168.2.2 10.1.1.2 UGHD 84 10802238 en4 - - 192.168.8.21 10.1.1.5 UGHD 4 1217 en4 - - 192.168.8.46 10.1.1.5 UGHD 2 65 en4 - - 192.168.8.54 10.1.1.5 UGHD 3 648 en4 - - 192.168.8.57 10.1.1.5 UGHD 4 3453 en4 - - 192.168.8.60 10.1.1.5 UGHD 2 177 en4 - - 192.168.8.61 10.1.1.5 UGHD 4 4398 en4 - - 192.168.8.62 10.1.1.5 UGHD 2 255 en4 - - cor200 10.1.1.5 UGH 0 96502 en4 - - 192.168.8.69 10.1.1.5 UGHD 6 3317 en4 - - 192.168.8.70 10.1.1.5 UGHD 6 10775 en4 - - 192.168.168/24 10.1.200.90 UG 32 27315560 en4 - -

Route Tree for Protocol Family 24 (Internet v6): ::1 ::1 UH 0 0 lo0 - - }}}

In the example shown above, the route to {{{fts.ftsinfo.com}}} should be deleted.

==== 2. Check the configuration of /etc/hosts ====

This is an optional step, but it can be quite useful:

{{{ # grep -i fts /etc/hosts 145.246.6.200 fts.ftsinfo.com FTS.FTSINFO.COM }}}

==== 3. Delete the route using the route command ====

Use the {{{route delete}}} command, of course, as follows:

{{{ # route -v delete -host fts.ftsinfo.com so_dst: inet 145.246.6.200; RTM_DELETE: Delete Route pid: 0, len 1124, seq 1, errno 0, flags:<UP,GATEWAY,HOST> number of gids: 0

locks: inits: sockaddrs: <DST> fts.ftsinfo.com newroute: fts.ftsinfo.com host fts.ftsinfo.com }}}

==== 4. Check the new route configuration ====

See point 1 above.

{{{ # netstat -r Routing tables Destination Gateway Flags Refs Use If Exp Groups

Route Tree for Protocol Family 2 (Internet): default 10.1.1.1 UG 2 317893 en4 - - 10.1.0.0 superman UHSb 0 0 en4 - - => 10.1/16 superman U 64 600214451 en4 - - apsysuk3 loopback UGHS 1618 2303493101 lo0 - - 10.1.255.255 superman UHSb 2 149868 en4 - - 10.200.200/24 10.1.200.90 UG 1 53746 en4 - - 10.254.212/24 10.1.200.90 UG 0 5425074 en4 - - 10.254.214/24 10.1.200.90 UG 0 8318252 en4 - - 10.254.218.135 10.1.200.10 UGHD 10 5348 en4 - - 10.254.218.136 10.1.200.10 UGHD 4 153185 en4 - - 10.254.218.137 10.1.200.10 UGHD 20 93017 en4 - - 10.254.218.138 10.1.200.10 UGHD 5 2534 en4 - - 10.254.218.139 10.1.200.10 UGHD 1 187 en4 - - 10.254.218.144 10.1.200.10 UGHD 9 8644 en4 - - 10.254.218.145 10.1.200.10 UGHD 11 1565 en4 - - 10.254.218.149 10.1.200.10 UGHD 9 33101 en4 - - 10.254.218.151 10.1.200.10 UGHD 1 40532 en4 - - 10.254.218.153 10.1.200.10 UGHD 11 12368 en4 - - 127/8 loopback U 28 6512945 lo0 - - 192.168.2.2 10.1.1.2 UGHD 86 10810396 en4 - - 192.168.8.21 10.1.1.5 UGHD 4 1217 en4 - - 192.168.8.46 10.1.1.5 UGHD 2 65 en4 - - 192.168.8.54 10.1.1.5 UGHD 4 1156 en4 - - 192.168.8.57 10.1.1.5 UGHD 4 3453 en4 - - 192.168.8.60 10.1.1.5 UGHD 2 177 en4 - - 192.168.8.61 10.1.1.5 UGHD 4 4398 en4 - - 192.168.8.62 10.1.1.5 UGHD 2 255 en4 - - cor200 10.1.1.5 UGH 0 96502 en4 - - 192.168.8.69 10.1.1.5 UGHD 6 3318 en4 - - 192.168.8.70 10.1.1.5 UGHD 6 10835 en4 - - 192.168.168/24 10.1.200.90 UG 32 27316017 en4 - -

Route Tree for Protocol Family 24 (Internet v6): ::1 ::1 UH 0 0 lo0 - - }}}

Good: no more route to {{{fts.ftsinfo.com}}}.

BUT... If the ODM (AIX internal database) contains the same route, it will reappear at the next reboot!

== Deleting a route permanently in the ODM ==

Of course, IBM had to invent a version of UNIX with the equivalent of the Windows Registry. Yuck.

Which means the {{{fts.ftsinfo.com}}} route will come back from the dead, zombie-like, every time the machine is rebooted.

So, follow the steps below to get rid, once and for all, of this "zombie" route:

==== 1. Check the inet0 configuration ====

To check this ODM configuration, use the {{{lsattr}}} command as in the example below:

{{{ # lsattr -El inet0 authm 65536 Authentication Methods True bootup_option no Use BSD-style Network Configuration True gateway Gateway True hostname superman Host Name True rout6 IPv6 Route True route net,-hopcount,0,,0,10.1.1.1 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,192.168.168.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.200.200.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.212.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.214.0,10.1.200.90 Route True route host,-hopcount,0,,,,,,192.168.8.65,10.1.1.5 Route True route host,-hopcount,0,,,,,,146.246.6.200,10.1.1.4 Route True route host,-hopcount,0,,,,,,145.246.6.200,10.1.1.4 Route True # grep -i fts /etc/hosts 145.246.6.200 fts.ftsinfo.com FTS.FTSINFO.COM }}}

Please note, in the example shown above, that two routes actually exist: {{{146.246.6.200}}} and {{{145.246.6.200}}}.

Both should be deleted.

==== 2. Delete the ODM route configuration ====

To do this, use the {{{chdev}}} command:

{{{ # chdev -l inet0 -a delroute=146.246.6.200,10.1.1.4 inet0 changed }}}

Of course, you can then check the new configuration with the {{{lsattr}}} command.

Here is another example, using the output of {{{lsattr}}} to run the {{{chdev}}} command:

{{{ # lsattr -El inet0 authm 65536 Authentication Methods True bootup_option no Use BSD-style Network Configuration True gateway Gateway True hostname superman Host Name True rout6 IPv6 Route True route net,-hopcount,0,,0,10.1.1.1 Route True route net,-hopcount,0,,,,,,192.168.2.0,10.1.1.2 Route True route net,-hopcount,0,,,,,,145.246.6.200,10.1.1.4 Route True route net,-hopcount,0,,,,,,192.168.168.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.212.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.214.0,10.1.200.90 Route True route net,-hopcount,0,,,,,,10.200.200.0,10.1.200.90 Route True route net,-hopcount,0,,,,,,192.168.8.0,10.1.1.5 Route True

# chdev -l inet0 -a delroute=net,-hopcount,0,,,,,,145.246.6.200,10.1.1.4 Method error (/usr/lib/methods/chginet): 0514-068 Cause not known. 0821-279 writing to routing socket: The process does not exist. route: not in table or multiple matches 0821-103 : The command /usr/sbin/route delete -net -hopcount 0 145.246.6.200 10.1.1.4 failed. }}}

Please note that the {{{chdev}}} command shown above threw up some error messages.

However, the change was taken into account, as can be seen in the subsequent output:

{{{ # lsattr -El inet0 authm 65536 Authentication Methods True bootup_option no Use BSD-style Network Configuration True gateway Gateway True hostname superman Host Name True rout6 IPv6 Route True route net,-hopcount,0,,0,10.1.1.1 Route True route net,-hopcount,0,,,,,,192.168.168.0,10.1.200.90 Route True route net,-hopcount,0,,,,,,10.200.200.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.212.0,10.1.200.90 Route True route net,-hopcount,0,-netmask,255.255.255.0,,,,,10.254.214.0,10.1.200.90 Route True route net,-hopcount,0,,,,,,192.168.8.0,10.1.1.5 Route True route net,-hopcount,0,,,,,,192.168.2.0,10.1.1.2 Route True }}}

As you can see above, the route to {{{145.246.6.200}}} has been correctly deleted from the machine ODM. It should **not** reappear, even if the machine is later rebooted.

Hope this helps!

== See Also: ==