Once the routing is mentioned, I must briefly introduce the role of routing. In a TCP/IP network, when a data packet is transmitted from one computer to another, the two computers may have no relationship with IP addresses. But how does the source computer that sends data packets know to send this data packet through the correct "road"? This is the role of routing. A simple description of a route can be a predetermined IP address, which may be a router or a computer with a routing function. It can tell you the correct path to the target address (or subnet, generally, the route targets include the host, subnet, and default. If a destination address (or subnet) does not have a specific route, use the default route (that is, the gateway we call ).
Generally, if there is no route (including the default gateway), you can only access the computer of the same network segment through broadcast, you may be able to access any computer in the world (as long as the network is connected, with the correct IP address and route pointing), and of course, it also allows you to access. From one IP address to another, it may go through multi-layer routing. For example, the first vro may only transmit information to the next vro, And the next vro transmits information to the next vro, until the target is reached. With traceroute of Unix/Linux or tracert of windows, we can correctly know the route path:
C:>tracert -d 71.5.7.191 Tracing route to 71.5.7.191 over a maximum of 30 hops 1 * * * Request timed out. 2 16 ms 16 ms 16 ms 220.191.142.165 3 17 ms 17 ms 17 ms 61.130.125.73 4 20 ms 21 ms 21 ms 61.130.126.149 5 41 ms * 41 ms 202.97.43.177 6 40 ms 41 ms 42 ms 202.97.33.138 7 231 ms * 231 ms 202.97.51.174 8 1115 ms 1111 ms 1105 ms 202.97.49.130 9 230 ms 231 ms 230 ms 205.158.79.29 10 1115 ms 1122 ms 1123 ms 65.106.5.45 11 1127 ms * 1122 ms 65.106.2.158 12 463 ms 464 ms * 205.158.60.170 13 473 ms 472 ms 473 ms 71.5.7.191
The following describes how to view and configure the route list on AIX. For example, the query command is:
# Netstat-Rn
Routing tables Destination Gateway Flags Refs Use If PMTU Exp Groups Route Tree for Protocol Family 2 (Internet): default 10.0.100.250 UGc 0 0 en0 - - - 10.0.100.0 10.0.100.150 UHSb 0 0 en0 - - - => 10.0.100/24 10.0.100.150 U 2 2 en0 - - - 10.0.100.255 10.0.100.150 UHSb 0 3 en0 - - - 127/8 127.0.0.1 U 0 353 lo0 - - - Route Tree for Protocol Family 24 (Internet v6): ::1 ::1 UH 0 0 lo0 16896 - -
The red part indicates the default route, that is, the gateway address. You can use the following command to add a default route:
# Route add default 10.0.100.250 or
# Route add 0 10.0.100.250
It indicates that the IP address is not specified, or the target path is 0, that is, all addresses, using the route 10.0.100.250. In fact, this IP address is the gateway. However, the added routes are added to the routing table (Dynamic Routing) instead of the ODM database.
# Smit route, or similar commands
# Chdev-l inet0-a route = "net,-route count, 0, 0, 10.0.100.250 ″
As shown in the preceding figure, the route 10.0.100.250 will be used for the target address 0, which is actually the default route. In this way, the added route is a static route.
The following is an example of adding a dynamic route and deleting a dynamic route. The following shows that route 10.0.100.htm is used for the target subnet 10. 10. *. */24, where/24 indicates the subnet mask.
# Route add-net 10.10.0.0-netmask 255.255.255.0 10.0.100.htm
You can see the following information from netstat-RN.
10.10/24 10.0.100.251 UG 0 0 en4 - -
To delete this dynamic route, run the following command:
# Route Delete 10.10.0.0 10.0.100.htm
The following is an example of adding a static route and deleting a static route. This time, we only use the route 10.0.100.htm for the host 10.10.10.100 instead of for the network segment.
# Chdev-l inet0-a route = "host,-route count, 0, 10.10.10.100, 10.0.100.20 ″
The following information is displayed in netstat-Rn:
10.10.10.100 10.0.100.251 UGH 0 0 en4 - -
You can also use the following command to delete the static route
# Chdev-l inet0-A delroute = "host, 10.10.10.100, 10.0.100.20 ″
To clear all route tables or refresh the route tables, run the following command. Note: This command only refreshes (actually clears) The current route table and does not clear static routes in the ODM database. Therefore, the static routes written in the ODM database will continue to take effect after being restarted.
In addition, do not execute this command easily, because if you connect to the machine using different network segments, you can immediately disconnect your network by clearing the route table.
# Route-F
default 10.0.100.250 done dbtest loopback done
# Netstat-Rn
Routing tables Destination Gateway Flags Refs Use If Exp Groups Route Tree for Protocol Family 2 (Internet): 10.0.100.0 10.0.100.150 UHSb 0 0 en0 - - - => 10.0.100/24 10.0.100.150 U 2 2 en0 - - - 10.0.100.255 10.0.100.150 UHSb 0 3 en0 - - - 127/8 127.0.0.1 U 0 353 lo0 - - - Route Tree for Protocol Family 24 (Internet v6): ::1 ::1 UH 0 0 lo0 - -
Correct use of routes can reduce network jumps and even greatly increase network access speeds.