Objective: Complete this chapter, you can do the following things: Configuring Static Routing Configuring a default route browsing routing table
The concept of the route LAN and WAN is physically physically composed of many network segments (different from the network part of the IP address), which are connected to each other through the router. The role of the router is to send the data packet between the network. The route is the process of selecting the path sent by the packet. The router is a dedicated computer that implements this selection function. In some documents, the router also speaks the gateway. It can be imagined that there are many small networks in a large network, they are interconnected by routers, and there is a host in both distal ends. When a host wants to send a packet to the other end, it sends this package to a router closest to it. When this router accepts this packet, the next router reaches the target address. When this packet reaches the router, this router selects the next router. The packet is finally reached through the forwarding of the layer router to be directly sent to the router of the target host. IP routing is seen as an address route. It means that the transfer of packets in the network can only rely on the target address in the packet. The router is based on this address to forward the packet. This is also called step-by-step. The routing table can be split into network portions and host parts by using a network mask. When the router is determined whether the target address of the packet exists in a network that is directly connected to it (there is no need to forward it), the network portion of the target address will be extracted first and compared to its IP address. If both, it means that this packet can be sent directly to the target host, and the router discards the package. Some address pairs are included in the routing table. Each pair:
The network address of the target network Next "hop" IP address, typically the IP address of the router's IP address listed in the routing table must be directly connected to this machine. Although routing is usually used to find a network rather than for searching for individual hosts. However, the route of individual hosts is allowed in IP routing. A single host route allows administrators to be more flexible when the use of the control network is used and custom special routes. Creating a special route for a single independent host is very useful when the network is wrong. Use the target network address instead of the target host address to make the route more effective while making the routing table smaller. Some routers will automatically aggregate to simplify the routing table.
The default routing router typically supports one or more dynamic routing protocols, which allows information to dynamically exchange information with other routers in the network. This allows the administrator to avoid the cumbersome work of the routing of hundreds of thousands of routing in the manual routing table. A separate host in the network usually requires only a few records in this routing table. Each host can directly send data frames to other hosts in the same network. However, in order to send data to other networks, the most recent direct routing is defined in most hosts as the default route in the routing table. This default route will be used if routing information is found in the routing table. You can only define a default route in each host. Static routing although routing protocols can be dynamically exchanged routing information, there is no need in many cases. For example, when there is only one routing interconnection, the static route can be set when there is only one route interconnection. Static routes are hand-established and cannot be dynamically modified and learned. Setting the routing commands Different hosts and routers are not the same, and the specific commands and usage methods are used to see the appropriate manual. The following description uses commands in HP-UNIX.
The syntax of the route command: -f Let the route command "Flush" all routes.
-n shows all of the IP addresses of hosts and networks in the form of numbers (IP addresses). The default network address is displayed as "Default" except.
Add Host or Network DELETE in the routing table deletes the specified host and network address NET from the routing table indicates that the target is a network when the target address is a network address, for example 192.45.3 Host specifies the target as a host.
DEST points out the IP address of the host or network that the data package is sent. DEST can be a host name (or alias listed in / etc / hosts), a network name (or alias listed in / etc / networks), an Internet address, or keyword default. If the default keyword is specified, the default gateway entry will change to Gateway. If the target address of the packet is not matched with any address in the routing table, it will be sent to this Gateway specified address. Gateway pointed out that the gateway node to arrive at the goal. This address must use an IP address or a host name.
Count an integer, indicating that the gateway is a local host or a remote host. If count is greater than 0, the gateway is a remote host. If equals 0, the gateway is the local host. Default is 0.
Configuring default routes: # / usr / sbin / route add default 195.41.100.1 1
Configuring static routes: # / usr / sbin / route add net 195.41.216 195.41.216.2 1
Check routing table # netstat -r routing tables dest / netmask gateway 4136 195.41.216 195.41.216.2UH 0 523 lan0 4136 195.41.30 195.41.30.2U 2 0 lan1 1500 default 195.41.100.1UG 0 0 lan2 1500 Flags (mark) Meaning (meaning) U UP (start state) H . Each routing is: a target host or a target network network, a subnet mask and gateway is used to forward the packet. The Flags field shows whether this route is valid (UP) u, whether this route leads to the gateway (G), this route is a host routing or network routing (or no h), whether this route is dynamically created (D), is it? For a gateway (M) that has been modified, or has been marked as suspected (?), May be no ARP response. The REFS field displays the number of routes currently being active. Connection-based protocols typically need to maintain a routing in one connection, rather than giving a connection-based protocol to get a route when sending a packet. Use this field displays the number of packets sent by this route. The Interface field indicates the network card used by this route. Example
Route 1:
TO NetWork Port Next Hop How To Build 192.168.1.5 - Input 172.1.1 - INPUT 172.1.0.0. 192.168.1.5 - Study 192.168.1.8/30 192.168.1.5 - Study 10.0. 0.0 / 8 192.168.1.5 - Study 195.41.212.0/2437.19.7 INPUT, Static 195.41.215.0/24* 172.17.1.1 172.17.19.7 Input, StaticRoute 2:
TO NetWork Port GNext Hop How To Build 192.168.1.6 - Input 192.168.1.8/30 192.168.1.9 - Input 172.1.0.0/16 172.1.1 - Input 172.17.0.0.0/16 192.168.1.6 - Study 10.0. 0.0 / 8 192.168.1.9 - Study 195.41.212.0/24 192.168.1.5 Input, Static 195.41.215.0/24* 192.168.1.6 192.168.1.5 Input, Static
Route 3:
TO NetWork Port GNext Hop How To Build 192.168.1.8 - INPUT 10.0.0.0.0.1.1.1 - Input 192.168.1.4/30 192.168.1.10 - Study 172.1.0.0.0.0.0.0.0/16 192.168.1.10 - Study 172.17. 0.0 / 16 192.168.1.10 - Study 195.41.212.0/24 192.168.1.9 Input, static 195.41.215.0/24** 192.168.1.10 192.168.1.9 Input, Static
* If Possible for Router, IT IS Better to Use Default Route: 0.0.0.0 172.17.1.1 172.17.19.7 ** 0 b u u Use default route: 0.0.0.0 192.168.1.6 192.168.1.5 *** If possible for router, it is better to use default route: 0.0.0.0 192.168.1.10 192.168.1.9 for all PCs, set default gateway to the router it is connected to Additional to RAS, the following route should be set.:
195.41.215.0/2441.212.211 195.41.212.210 Input, Static
**** DO NOT SET IT AS Default Route