How To
Summary
In Advanced Interactive eXecutive (AIX) operating system, a route is information that tells the operating system how to access a particular network or host. It outlines the network interface to be utilized, the next IP address to reach, and the destination network or host to be reached.
The routes on an AIX systems are maintained by a database called the routing table. The routing table is used by the kernel to determine the best route to direct the data coming from the network (known as Packets). If no matching route is found, the packet is dropped.
Routing is a critical component of networking, and understanding how to manage routes is essential for system administrators working with AIX.
Objective
Steps
What is the typical routing mechanism in AIX?
The typical routing mechanism in AIX is based on the routing table, which is maintained by the kernel. The kernel uses the routing table to determine the best route for a packet, based on the destination IP address and the source and destination network interfaces.
When a packet arrives at an AIX system, the kernel looks up the destination IP address in the routing table. If a matching route is found, the kernel determines the outgoing network interface and the next hop address, if necessary, and sends the packet on its way.
If no matching route is found, the kernel might perform a default route lookup, which is a catch-all route used when no other route matches. If no default route is configured, the packet is dropped and an ICMP error message is sent back to the source.
The routing table can be modified by using the route command, which allows the addition, deletion, or modification of routes. For example, a new route for a specific network or host can be added, or an existing route can be modified to use a different next hop address.
Precedence of routes in the routing table
When a packet arrives at an AIX system, the kernel looks up the destination IP address in the routing table to determine the best route for the packet. The kernel selects the route with the longest prefix match to the destination IP address. In other words, the kernel matches the destination IP address of the packet with the network address of the routes in the routing table and selects the route with the longest matching prefix.
For example, the routing table contains the following two routes:
Routing tables
Destination Gateway Flags Refs Use If Exp Groups
Route Tree for Protocol Family 2 (Internet):
192.168.0.0/24 192.168.0.1 U 1 2 en0 - -
192.168.0.0/16 192.168.1.1 UG 0 0 en1 - -
If a packet arrives at the system with a destination IP address of 192.168.0.10, the kernel selects the first route because it has a longer matching prefix (24 bits) than the second route (16 bits).
Routes in AIX are evaluated in order of precedence. The kernel evaluates the routing table from top to bottom and selects the first matching route. In other words, the order of the routes in the routing table matters because the kernel selects the first matching route, even if there are other routes that could match.
For example, routing table contains the following two routes:
Routing tables
Destination Gateway Flags Refs Use If Exp Groups
Route Tree for Protocol Family 2 (Internet):
192.168.0.0/24 192.168.0.1 U 1 2 en0 - -
192.168.0.0/24 192.168.1.1 UG 0 0 en1 - -
If a packet arrives at the system with a destination IP address of 192.168.0.10, the kernel selects the first route because it appears first in the routing table, even though the second route also matches the destination IP address.
The routing table is evaluated in the same way for outgoing packets as it is for incoming packets, with the kernel selecting the route with the longest matching prefix. If a matching route is found, the kernel determines the appropriate network interface to use and the next hop address, if necessary.
Once the appropriate network interface and next hop address have been determined, the outgoing packet is sent out through the network interface, using the appropriate Ethernet MAC address.
Default Route
In AIX, a default route is a special route that is used when no other route matches the destination IP address of a packet. It is typically used as a catch-all route for packets that do not match any other route in the routing table.
When a packet arrives at an AIX system and no matching route is found in the routing table, the kernel uses the default route, if one is configured. The default route has a destination IP address of 0.0.0.0/0, which matches all IP addresses.
If a default route is configured in the routing table, the kernel will use it to send the packet to the next hop address specified in the default route. If no default route is configured, the packet is dropped and an ICMP error message is sent back to the source.
For example, routing table contains the following default route:
Routing tables
Destination Gateway Flags Refs Use If Exp Groups
Route Tree for Protocol Family 2 (Internet):
default 192.168.1.1 UG 1 2 en0 - -
If a packet arrives at the system with a destination IP address that does not match any other route in the routing table, the kernel will use the default route to send the packet to the next hop address 192.168.1.1, which is the gateway for the default route.
Multiple Default Routes
In AIX, having multiple default routes in the routing table can cause problems with routing packets correctly. When there are multiple default routes, the kernel might not know which route to use for a particular packet and might either drop the packet or send it to the wrong destination.
By default, AIX allows only one default route in the routing table at a time when an interface is initially configured by using smit mktcpip.
By using the route command, additional default routes can be added to AIX through the following syntax:
route add default [DEFAULT NEXT HOP IP]
While it is generally not recommended to configure multiple default gateways in AIX, there are some situations where it might be necessary or useful:
-
Redundancy: Configuring multiple default gateways can provide redundancy in case one gateway fails. If one gateway becomes unavailable, the system can automatically switch to the other gateway to ensure continued connectivity.
-
Load-balancing: Configuring multiple default gateways can also be used for load-balancing. By distributing traffic across multiple gateways, you can ensure that no single gateway becomes overloaded and that traffic is efficiently distributed.
A host can be configured to detect whether a gateway it is using is down, and can adjust its routing table accordingly.
Active Dead Gateway Detection (ADGD) is a network feature that is available on AIX systems and can be used to monitor the status of the default gateway and switch to a backup gateway if necessary.
Hosts can also be configured to use active dead gateway detection on a per-route basis with the -active_dgd flag of the route command.
Active dead gateway detection pings all gateways used by routes for which it is enabled every dgd_ping_time second. If no response is received from a gateway, it is pinged more rapidly up to dgd_packets_lost times. The AIX system will send ARP requests to the gateway. If the AIX doesn't receive a response for consecutive dgd_packets_lost requests, that gateway is assumed to be down and the distance metrics (also known as hopcount or cost) for all routes that use that gateway, are raised to the maximum value. The gateway continues to be pinged, and if a response is eventually received, the costs on the routes are restored to their user-configured values.
The dgd_ping_time, dgd_packets_lost, and dgd_retry_time parameters can all be configured by using the no command.
Configuring a redundant default gateway requires:
- The primary gateway to set active_dgd enabled.
- The backup gateway to be configured with a higher cost than the primary gateway.
For example, routing table contains the following default route by using the default cost of 0:
Routing tables
Destination Gateway Flags Wt Policy If Cost Config_Cost
Route Tree for Protocol Family 2 (Internet):
default 192.168.1.1 UGA 1 WRR en0 0 0 =>
- The default gateway 192.168.1.1 has the flag A set indicating ADGD is enabled.
- The default gateway 192.168.1.1 has the cost of 0 indicating lowest cost for default gateway.
The redundant gateway is then added by using the syntax:
route add default 192.168.2.1 -hopcount 10
The route command will add a default gateway with the IP 192.168.2.1, and the -hopcount indicates the cost of the backup gateway to 10.
The resulting routing table will be:
Routing tables
Destination Gateway Flags Wt Policy If Cost Config_Cost
Route Tree for Protocol Family 2 (Internet):
default 192.168.1.1 UGA 1 WRR en0 0 0 =>
default 192.168.2.1 UG 1 -"- en0 0 10
- The following errpt entry is logged
-
101F1D7C 0406200923 T U sysxinet DEAD GATEWAY DETECTED
-
- The routing table is changed accordingly
-
Routing tables Destination Gateway Flags Wt Policy If Cost Config_Cost Route Tree for Protocol Family 2 (Internet): default 192.168.2.1 UG 1 WRR en0 0 10 => default 192.168.1.1 UGA 1 -"- en0 MAX 0
-
Configuring ADGD on primary default gateway
Configuring ADGD on a currently set primary default gateway is done through:
- smitty mktcpip
- Select the primary interface configured for AIX (for example, en0)
-
Minimum Configuration & Startup To Delete existing configuration data, please use Further Configuration menus Type or select values in entry fields. Press Enter AFTER making all desired changes. [TOP] [Entry Fields] * HOSTNAME [testaix] * Internet ADDRESS (dotted decimal) [192.168.1.10] Network MASK (dotted decimal) [255.255.255.0] * Network INTERFACE en0 NAMESERVER Internet ADDRESS (dotted decimal) [] DOMAIN Name [] Default Gateway Address (dotted decimal or symbolic name) [192.168.1.1] Cost [0] # Do Active Dead Gateway Detection? yes + Your CABLE Type N/A + START Now no + F1=Help F2=Refresh F3=Cancel F4=List Esc+5=Reset F6=Command F7=Edit F8=Image F9=Shell F10=Exit Enter=DoChanging the Do Active Dead Gateway Detection? to yes enables the ADGD on the default gateway 192.168.1.1.
-
chdev command
-
A terminal connection through the HMC is required as connection might be interrupted.
-
Running lsattr -El inet0 results in an output similar to:
-
lsattr -El inet0 authm 65536 Authentication Methods True bootup_option no Use BSD-style Network Configuration True gateway Gateway True hostname testaix Host Name True rout6 IPv6 Route True route net,-hopcount,0,,0,192.168.1.1 Route True -
Execute the following command to delete the gateway:
-
chdev -l inet0 -a delroute=net,-hopcount,0,,0,192.168.1.1- Execute the following command to add the gateway back with -active_dgd:
-
chdev -l inet0 -a delroute=net,-hopcount,0,-active_dgd,0,192.168.1.1
Running smitty mktcpip must be executed with caution. The mktcpip command functions include making entries in the /etc/hosts file for the host name and IP address, and it rebuilds the routing table inet0, and might result in deleting entries added by route command.
-
Weighted routing is a technique used in AIX to distribute traffic across multiple gateways or routes by using a weight or priority value. This enables you to control how traffic is distributed across multiple paths, ensuring that traffic is distributed in the most efficient and effective way possible.
In weighted routing, each route or gateway is assigned a weight or priority value. The weight indicates the relative importance of the route or gateway and determines how much traffic is sent through it. A higher weight value means that more traffic is sent through that route or gateway.
When a packet arrives at the system, the kernel selects the best route based on the weight or priority of each route. The kernel selects the route with the highest weight value as the preferred route, and forwards the packet using that route. If multiple routes have the same weight value, the kernel uses other criteria, such as the lowest hop count or lowest metric, to determine the best route.
In AIX, routes can be configured to have different weights by using the route command. There are different weight policies used. If the policy is not explicitly set and multipath routing is used, then the global no command option called mpr_policy determines the policy that is used. The default policy is Weighted Round Robin which behaves just like Round-Robin when the weights are all 1. Although the Default policy is Weighted Round-Robin, when the policy is not set, then the network option mpr_policy takes precedence. On the other hand, if the policy is explicitly set to WRR then this setting overrides the mpr_policy setting.
The different multipath routing policies are:
-
Weighted Round-Robin: In weighted round-robin policy, each route or gateway is assigned a weight value that represents the proportion of traffic that is to be sent through that route. The kernel then cycles through each route in round-robin fashion, sending a portion of traffic to each route based on its weight value.
-
Random: In the random policy, the kernel selects a random route or gateway for each packet. This can be useful in load-balancing scenarios where it is desired to distribute traffic evenly across multiple paths.
-
Weighted Random: The weighted random policy is similar to the random policy, but each route or gateway is assigned a weight value that determines the probability of that route being selected. Routes with a higher weight value have a higher probability of being selected.
-
Lowest Utilization: In the lowest utilization policy, the kernel selects the route or gateway with the lowest utilization or traffic load. This can be useful in scenarios where it is desired to balance traffic across multiple paths while minimizing congestion.
-
Hash-based: Hash-based algorithm chooses a route by hashing based on the destination IP address.
MPR policies and the no command
Help for tunable mpr_policy:
Purpose:
Specifies the policy to be used for Multipath Routing.
Values:
Default: 1
Range: 1 - 6
Type: Dynamic
Unit: numeric
Tuning:
Available routing policies are:
Weighted Round-Robin (1) - Based on user-configured weights assigned to the multiple routes (through the route command) round-robin is applied. If no weights are configured then it behaves identical to plain round-robin.
Random (2) - Chooses a route at random.
Weighted Random (3) - Chooses a route based on user-configured weights and a randomization routine. The policy adds up the weights of all the routes and pick a random number between 0 and total weight. Each of the individual weights are removed from the total weight, until this number is zero. This picks a route in the range of the total number of routes available.
Lowest Utilization (4) - Chooses a route with the minimum number of current connections going through it.
Hash-based (5) - Hash-based algorithm chooses a route by hashing based on the destination IP address.
For example, the routing table contains the following default route:
Routing tables
Destination Gateway Flags Wt Policy If Cost Config_Cost
Route Tree for Protocol Family 2 (Internet):
default 192.168.1.1 UG 1 WRR en0 0 0 =>
- The default gateway 192.168.1.1 has the Weight (Wt) set to 1.
- The default gateway 192.168.1.1 uses the policy Weighted Round Robin (WRR).
To enable Multi-Path Routing (MPR) for the AIX system, the default gateway 192.168.1.1 needs to be further configured before adding a new default route. If no weight is to be configured for the default 192.168.1.1 default route and for the additional default route, AIX constantly switches between the two routes in a round-robin method.
Further configuration for the 192.168.1.1 default route can include:
- Giving the route a specific weight.
- Changing the routing policy for the route.
route set default 192.168.1.1 -weight <weight number>
route set default 192.168.1.1 -policy <policy number>
- Change the weight for the 192.168.1.1 default route to a higher value than 1:
-
route set default 192.168.1.1 -weight 10
-
- Add the new default route 192.168.2.1 with a weight that is less than the weight of the preferred route:
-
route add default 192.168.2.1 -weight 5
-
Routing tables
Destination Gateway Flags Wt Policy If Cost Config_Cost
Route Tree for Protocol Family 2 (Internet):
default 192.168.1.1 UG 10 WRR en0 0 0 =>
default 192.168.2.1 UG 5 -"- en0 0 0 =>
In this Example, we have two default routes, one with an IP address of 192.168.1.1 and a weight of 10, and the other with an IP address of 192.168.2.1 and a weight of 5. A weighted round-robin policy to distribute traffic across these two routes is used.
In the weighted round-robin policy, each route is assigned a weight value that represents the proportion of traffic that is to be sent through that route. In this scenario, the first route has a weight of 10 and the second route has a weight of 5.
When a packet arrives at the system, the kernel cycles through each route in round-robin fashion, sending a portion of traffic to each route based on its weight value. In this scenario, the kernel would first send 10 packets to the first route (192.168.1.1) before sending 5 packets to the second route (192.168.2.1). After that, the kernel would cycle back to the first route and repeat the process.
Static Routes
In AIX, static routes are used to manually specify a particular path for network traffic to take when there is no dynamic routing protocol available or when a specific routing path is preferred over others. Static routes are configured in the system's routing table and are not automatically updated like dynamic routes.
When a packet arrives at the AIX system, the kernel uses its routing table to determine the best path for the packet to take to reach its destination. If a matching entry is found in the routing table, the packet is forwarded to the next hop specified in that entry. If there is no matching entry, the kernel forwards the packet to the default gateway (if configured), or it drops the packet if there is no default gateway.
Static routes work by adding entries to the routing table that specify the destination network or IP address and the gateway to use to reach that destination.
Once the static route is added to the routing table, the kernel uses it to forward packets that match the destination network or IP address specified in the static route. When a packet matches a static route, the kernel forwards the packet to the gateway specified in the static route. The gateway then takes responsibility for forwarding the packet toward its final destination.
To add a static route to a network in AIX, the route command can be used with the following syntax:
route add <destination network> <gateway> [-netmask <netmask>] [-if <interface>]
<destination network>specifies the destination network or IP address for the static route.<gateway>specifies the IP address of the gateway for the static route.<netmask>specifies the netmask for the destination network. If not specified, it defaults to the natural netmask of the network.<interface>specifies the network interface to use for the static route. If not specified, the kernel selects the appropriate interface based on the routing table.
route command can be used with the following syntax:
route add -host <destination host> <gateway> [-if <interface>]
- Run smit route
- Select Add a Static Route
-
Add Static Route Type or select values in entry fields. Press Enter AFTER making all desired changes. [Entry Fields] Destination TYPE net + * DESTINATION Address [] (dotted decimal or symbolic name) * Default GATEWAY Address [] (dotted decimal or symbolic name) COST [0] # Network MASK (hexadecimal or dotted decimal) [] Network Interface [] + (interface to associate route with) Enable Active Dead Gateway Detection? no + Is this a Local (Interface) Route? no + Policy (for Multipath Routing Only) Default (Global) + Weight (for Weighted Multipath Routing Policy) [1] # Apply change to DATABASE only no +
Additional Information
| SUPPORT |
|---|
|
If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract. 1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue. 2. Capture any logs or data relevant to the situation. 3. Contact IBM to open a case: -For electronic support, see the IBM Support Community: 4. Provide a clear, concise description of the issue. - For more information, see: Working with IBM AIX Support: Describing the problem. 5. If the system is accessible, collect a system snap, and upload all of the details and data for your case. - For more information, see: Working with IBM AIX Support: Collecting snap data |
Mustafa Atallah
Reviewed by:
Darshan Patel
Related Information
Document Location
Worldwide
Product Synonym
AIX
Was this topic helpful?
Document Information
Modified date:
18 April 2023
UID
ibm16981039