Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the use of routing tables?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the usefulness of routing tables. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

The role of routing table

The function of the routing table is similar to that of navigation, telling the host where the packet should be forwarded. If the host does not contain a routing table, then all its packets cannot be delivered. So it doesn't matter about the router, the host will have its own routing table.

Routing table format

Disclaimer: all operations in this article are done under the linux host.

It is easy to view the routing table. You can use route-n. The-n option means no host reverse check is performed.

# route-n Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.110.1 0.0.0.0 UG 1000 eth0192.168.110.0 0.0.0.0 255.255.255.0 U 10000 eth0

As you can see, my host contains two routing tables. A routing message mainly consists of several points:

Destination address

Next hop address

Subnet mask

Network card interface

Looking at the first route, the destination address is 0.0.0.0 and the subnet mask is 0.0.0.0, which is called the default route. The default route is very important, which means that if no other route can forward the packet, then use the default route to forward the packet. So, that's why the next hop address of the default route is the gateway address. Because my home network is relatively simple, only connected to a router, to communicate with the external network must go through this router. The location of this router is also the gateway address. So, this explains the problem at the beginning of the article.

Next look at the second route, it is also quite special, its destination address is the local network address, the subnet mask is also the local subnet mask, its next hop address is 0.0.0.0. 0.0.0.0 means that you do not need to go through the router and deliver directly. Then it means that to communicate with the host in the local area network, you don't need to go through the router and deliver it directly.

Add routing tabl

Adding a routing table is also very simple, through the command

Route add [- net |-host] destination host or destination network\ > [netmask subnet mask]\ > [gw next hop address]\ > [[dev] interface address]

Here's how to add a specific host route

# route add-host 192.168.110.111 gw 192.168.110.1 dev eth0

In this way, a routing message is added successfully.

Thank you for reading! So much for sharing about the use of the routing table. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report