IBM Support

Why does the chdev command to add a static route fail with the error "0821-228 chgif: Bad attribute(s) or attribute value(s): route"?

Question & Answer


Question

For the following routing table, why does the chdev command to add a static route fail with the error "0821-228 chgif: Bad attribute(s) or attribute value(s): route"?

# netstat -rn                                                  
Routing tables
Destination        Gateway           Flags   Refs     Use  If   Exp  Groups
Route Tree for Protocol Family 2 (Internet):
default            10.99.0.200       UG        0      2938 en1      -      -   
5.26.0.0           5.26.0.20         UHSb      0         0 en2      -      -   =>
5.26/25            5.26.0.20         U         0         0 en2      -      -   
5.26.0.20          127.0.0.1         UGHS      0         0 lo0      -      -   
5.26.0.127         5.26.0.20         UHSb      0         0 en2      -      -   
10.99.0.0          10.99.13.58       UHSb      0         0 en1      -      -   =>
10.99/16           10.99.13.58       U         2  47147499 en1      -      -   
10.99.13.58        127.0.0.1         UGHS      0        28 lo0      -      -   
10.99.255.255      10.99.13.58       UHSb      0         4 en1      -      -   
127/8              127.0.0.1         U         4     28216 lo0      -      - 
# chdev -l en2 -a route=net,-netmask,255.0.0.0,-static,5.0.0.0,5.26.0.130   
Method error (/usr/lib/methods/chgif):
        0514-018 The values specified for the following attributes
                 are not valid:
0821-228 chgif: Bad attribute(s) or attribute value(s): route
# chdev -l en2 -a route="net,5.0.0.0,5.26.0.130,5.0.0.0"                    
Method error (/usr/lib/methods/chgif):
        0514-018 The values specified for the following attributes
                 are not valid:
0821-228 chgif: Bad attribute(s) or attribute value(s): route

Answer

The chdev fails because "route" is an invalid attribute for the interface. The correct syntax to add a route is as below.

# chdev -l inet0 -a route=net,-netmask,255.0.0.0,-static,5.0.0.0,5.26.0.130         
inet0 changed
The highlighted line in the routing table below displays the added route.
# netstat -rn                                                              
Routing tables
Destination        Gateway           Flags   Refs     Use  If   Exp  Groups
Route Tree for Protocol Family 2 (Internet):
default            10.99.0.200       UG        1      3537 en1      -      -   
5/8                5.26.0.130        UGS       0         0 en1      -      -   
5.26.0.0           5.26.0.20         UHSb      0         0 en2      -      -   =>
5.26/25            5.26.0.20         U         0         0 en2      -      -   
5.26.0.20          127.0.0.1         UGHS      0         0 lo0      -      -   
5.26.0.127         5.26.0.20         UHSb      0         0 en2      -      -   
10.99.0.0          10.99.13.58       UHSb      0         0 en1      -      -   =>
10.99/16           10.99.13.58       U         2  47152420 en1      -      -   
10.99.13.58        127.0.0.1         UGHS      0        28 lo0      -      -   
10.99.255.255      10.99.13.58       UHSb      0         4 en1      -      -   
127/8              127.0.0.1         U         4     28476 lo0      -      -  
To delete the route, use following syntatx.
# chdev -l inet0 -a delroute=net,-netmask,255.0.0.0,-static,5.0.0.0,5.26.0.130
inet0 changed

The route command also adds the route, but it doesn't write to the ODM. Hence, unlike the chdev command, the change will not survive the reboot.

# route add -net 5.0.0.0 -netmask 255.0.0.0 5.26.0.130                              
5.26.0.130 net 5.0.0.0: gateway 5.26.0.130
The highlighted line in the routing table below displays the added route.
# netstat -rn                                         
Routing tables
Destination        Gateway           Flags   Refs     Use  If   Exp  Groups
Route Tree for Protocol Family 2 (Internet):
default            10.99.0.200       UG        2      3565 en1      -      -   
5/8                5.26.0.130        UG        0         0 en1      -      -   
5.26.0.0           5.26.0.20         UHSb      0         0 en2      -      -   =>
5.26/25            5.26.0.20         U         0         0 en2      -      -   
5.26.0.20          127.0.0.1         UGHS      0         0 lo0      -      -   
5.26.0.127         5.26.0.20         UHSb      0         0 en2      -      -   
10.99.0.0          10.99.13.58       UHSb      0         0 en1      -      -   =>
10.99/16           10.99.13.58       U         2  47152603 en1      -      -   
10.99.13.58        127.0.0.1         UGHS      0        28 lo0      -      -   
10.99.255.255      10.99.13.58       UHSb      0         4 en1      -      -   
127/8              127.0.0.1         U         4     28492 lo0      -      -   
To delete the route, run following command.
# route delete -net 5.0.0.0 -netmask 255.0.0.0 5.26.0.130
5.26.0.130 net 5.0.0.0: gateway 5.26.0.130
Author: Darshan Patel
Platform: AIX on Power
Feedback: aix_feedback@wwpdl.vnet.ibm.com

[{"Type":"MASTER","Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cvzIAAQ","label":"Networking"}],"ARM Case Number":"TS018400922","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions"}]

Document Information

Modified date:
14 February 2025

UID

ibm17182668