Route table details

Source: Internet
Author: User

C: \ Documents ents and Settings \ Administrator> route print
========================================================== ==========================================
Interface list
0x1... ms tcp loopback interface
0x2... 00 16 EC 6a 6D 7E ...... RealTek rtl8139 family PCI Fast Ethernet NIC-
Micro port of the data packet scheduler
========================================================== ==========================================
========================================================== ==========================================
Active routes:
Network destination netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.21.253 192.168.21.75 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.21.0 255.255.255.0 192.168.21.75 192.168.21.75 20
192.168.21.75 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.21.255 255.255.255.255 192.168.21.75 192.168.21.75 20
224.0.0.0 240.0.0.0 192.168.21.75 192.168.21.75 20
255.255.255.255 255.255.255.255 192.168.21.75 192.168.21.75 1
Default Gateway: 192.168.21.253
========================================================== ==========================================
Persistent routes:
None

The upper part is the interface list, the middle part is the active route (active routes), and the lower part is static

Persistent routes, which has no content currently.

The route table contains the following columns:
Network destination: Destination CIDR Block, address, or special address (if the subnet mask is 255.255.255.255, the destination is

Addresses or special addresses)
Netmask: Subnet Mask. After an IP address and subnet mask are in place and, the IP address segment can be obtained. If the IP address and subnet mask are used

The host address of the IP address.
Interface: network interface used to remove the destination IP address
Gateway: the gateway IP address. In general, the interface and gateway are in the same network segment (What are the exceptions ?)
Metric: Number of hops. The quality of this route record. Generally, if multiple route records arrive at the same destination, the router will

Use the route with a small metric Value

Prepare a bit more knowledge: In normal mode, the network card can issue an IP packet of any address. The number of IP packets that can be received is limited: a ip address package; B

The broadcast package of the CIDR Block and the C multicast package. Other packages cannot be received. Other IP packets can be received only when the NIC is set to listening mode. (IP and

How to match Mac ?)
The route should be the process of the sent package. When sending a packet, you must know the corresponding MAC address.

The routes listed above are explained one by one:
Article 1:
0.0.0.0 is the default route, which means that when the destination CIDR block of a data packet is not in your route record

Where to send the packet. Because the calculation method of whether a specific target address matches the target address of the route is

Address and subnet mask. If the result is the same as the target address, this address matches this one. If we define

The number of digits is the matching degree. Any address and mask 0.0.0.0 and is equal to 0.0.0.0, and the matching degree is 0 (not unmatched, not matching)

Low ). In this way, any address will be sent from the network interface 192.168.21.75 and sent to the gateway 192.168.21.253 to allow the Gateway

Decide what to do. The structure of the package is that the Mac is the MAC address of the gateway, and the address inside is the target address.

Article 2:
The local loop, all the addresses starting with 127, can match this one with the previous one, but the matching degree of this one is 8, so priority is given to this one.

. In this way, all the addresses starting with 127 are sent from the 127.0.0.1 interface. The Gateway is the same as the interface, that is, there is no gateway. While

The address 127.0.0.1 is the test loop of the virtual network card and will not be passed to the real network card. Sniffer cannot catch Ping

127.0.0.1 package.

Article 3:
All the addresses starting with 192.168.21 can match this route entry and the first route entry, but the matching degree of this route entry is 24.

Take this item as a priority. The addresses starting with 192.168.21 are all sent from the network interface 192.168.21.75.

The interface is the same, that is, there is no gateway. In this case, you must know the MAC address of the target IP address.

Article 4:
The local route, the packet sent to the IP address (192.168.21.75), can match this one, the first and the third, but the matching degree of this one

Therefore, priority is given to 32. The packet sent to 192.168.21.75 is directly sent to the test loop of the virtual network card.

The package cannot be caught.

Article 5:
The broadcast packet of the CIDR block, with the packet 192.168.21.255, can match this one, the first and the third, but the matching degree of this one is 32.

The priority is the same as that of the third article. However, if we do this, we can

The host cannot issue a broadcast packet (Ping 192.168.21.255 and there will be a broadcast packet caught)

Article 6:
For multicast packets, IP addresses and subnet masks are used to calculate the IP address range (the first few target masks are both 0 or 255, and do not need to be like

)
Start address: 224.0.0.0 and 240.0.0.0 = 224.0.0.0
End address: 224.0.0.0 or not 240.0.0.0 = 224.0.0.0 or 15.255.255.255 = 239.255.255.255
These IP addresses are directly sent using the 192.168.21.75 interface. for Mac, the following principles are used for setting:
To support IP multicast, Internet authorities reserve multicast addresses in the range from 01-00-5e-00-00-00 to 01-00-5e-7f-ff-ff

Fiber Distributed Data Interface (FDDI) Media Access Control (MAC) Address

. To map an IP multicast address to a MAC layer multicast address, the 23 low-order bits of the IP multicast address are directly mapped to the MAC layer multicast address.

23 low-order addresses. According to Class D address conventions, the first four digits of an IP multicast address are fixed. Five digits of an IP multicast address are not mapped to multiple IP addresses on the MAC layer.

Playback address. Therefore, a host can receive Mac-layer multicast data packets that are not in the group to which it belongs. However, once the target IP address is determined

These packets will be discarded by the IP address.
For example, the multicast address 224.192.16.1 is changed to 01-00-5e-40-10-01. To use the 23 low-order bits, the first eight-bit group will not

Used. Only the last 7 digits in the second eight-digit group are used. The third and fourth octal groups are directly converted to hexadecimal numbers. For

For the second eight-bit group, the binary value 192 indicates 11000000. If the high-order bit is discarded, it will become 1000000 or 64 (decimal) or 0x40 (

Hexadecimal ). For the next eight-digit group, the hexadecimal value of 16 indicates 0x10. For the last eight-digit group, the hexadecimal value of 1 indicates 0x01.

. Therefore, the MAC address corresponding to 224.192.16.1 is changed to 01-00-5e-40-10-01.

Why do I need to list multicast separately? This is because when we want to send multicast packets, we assume that the IP address is 224.192.16.1. If this IP address is not included

The package conforms to the first one, and the system sends it out using the MAC package of the gateway, which violates the Mac standard we mentioned above. With this

One, then the multicast uses the above principles to establish a Mac, and then sends it from the standard port, so that the computer to receive the received.

Article 7:
Broadcast address, only one IP address 255.255.255.255, which is directly sent by 192.168.21.75.

The preceding figure shows the routes of a well-regulated computer. Standard seven packages: default route, local loop, direct network segment, local address,

CIDR Block broadcast, multicast, and broadcast.

Next we will start to modify the route table and test some ideas.
1: change the route of the local address from 127.0.0.1 to 192.168.21.75.
First, run the following command:
Route change 192.168.21.75 mask 255.255.255.255 192.168.21.75 metric 20
However, the result is: the route specified was not found.
It is acceptable to query the network statements: these are special routes and cannot be deleted like this.
In this way, I will add a route, and the number of hops is smaller than the default one.
Route add 192.168.21.75 mask 255.255.255.255 192.168.21.75 metric 1
This is successful. Then, ping the IP address of the local machine. The result is that my firewall does not allow Ping, open it, or ping fails, and there is no available information with tracert.
Later, ARP-A is used to check that all the MAC addresses of 192.168.21.75 in the address list are 0. Therefore, an ARP record is added.
ARP-s 192.168.21.75 00-16-ec-6a-6d-7e
Now ping again, it will be normal, and sniffer will also catch the package.
Use a large package to check the connection speed
Ping 192.168.21.75-l 65000
Return
Reply from 192.168.21.75: bytes = 65000 time = 1 ms TTL = 64

Connection speed with General computers
Ping 192.168.21.60-l 65000
Return
Reply from 192.168.21.60: bytes = 65000 time = 12 Ms TTL = 128

Connection speed with local loop
Ping 127.0.0.1-l 65000
Return
Reply from 127.0.0.1: bytes = 65000 time <1 ms TTL = 64

2. What if the CIDR block is set as a gateway?
Route add 192.168.21.0 mask 255.255.255.0 192.168.21.253 metric 10
Ping 192.168.21.60
The result is packaged by the vro192.168.192.168.21.253.
Tracert 192.168.21.60-D also shows this point.
Before adding:
Tracing Route to ntserver [192.168.21.60]
Over a maximum of 30 hops:
1 <1 MS <1 MS <1 MS 192.168.21.60
Trace complete.
Added:
Tracing Route to ntserver [192.168.21.60]
Over a maximum of 30 hops:
1 <1 MS <1 MS <1 MS 192.168.21.253
2 2 MS 2 MS 192.168.21.60
Trace complete.

3. What if I set a non-existent IP address?
Run the following command, but the gateway changes to a non-existent IP--192.168.21.250.
Route add 192.168.21.0 mask 255.255.255.0 192.168.21.250 metric 10
Run Ping 192.168.21.60.
Through sniffer packet capture, we can see that my computer first had a broadcast packet ARP and wanted to get the MAC address 192.168.21.250, but no one responded, and finally the Ping showed time out.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.