Router forwarding rules

Source: Internet
Author: User

  1. Before initiating communications, the source host compares the Self IP address with the IP address of the target host. If the two are located in the same CIDR Block and are calculated using the subnet mask, the source host has the same network number ), then, the source host directly sends an ARP request to the target host. After receiving the ARP response from the target host, the source host obtains the MAC address of the target host and then uses the MAC address of the target host as the target MAC address to send packets, this is the case when host mutual access is located in the same VLAN network segment. This is because the interconnected switch performs layer-2 exchange forwarding.


  2. When the source host determines that the target host is in a different network segment, it submits packets through the gateway, that is, it sends an ARP request to obtain the MAC address corresponding to the gateway IP address, after obtaining the ARP response from the gateway, use the gateway MAC as the destination MAC for packet transmission ...... That is, a port of the router. Note that the source IP address of the message is the source host IP address, and the destination IP address is the target host IP address.

    Here, steps 1 and 2 are encapsulation of IP information first, and then three layers and two layers through ARP for MAC encapsulation processing). The opposite is to unpack.


  3. When the Gateway Router receives an Ethernet data frame, it finds that the target MAC address in the data frame is the physical address of a port of its own. In this case, the router removes the encapsulation of the Ethernet data frame. The router considers the IP packet to be forwarded by itself, and then it will include the destination address and the pointer to the destination address in the matching route table ). After a route entry is matched, it sends the package to the next address.

    The same is true for vro packet forwarding. It never changes the IP address, but only the source/Target MAC address.


  4. What if the target MAC address is a broadcast address? There are three types of IP broadcast:

    255.255.255.255 is called local broadcast or direct broadcast without cross-vro.

    172.16.33.255 is called subnet broadcast. It is broadcast to the subnet 172.16.33.0, which can be cross-router.

    172.16.255.255 is called full subnet broadcast. It is broadcast to the main network 172.16.0.0, which can be cross-router.

    A vro is a layer-3 device that can isolate broadcasts, but not all broadcasts. In fact, only the local broadcast Router does not forward the broadcast. For subnet broadcast and full subnet broadcast, the router forwards the broadcast. Why? In the MAC encapsulation, the target MAC is broadcast, and the subnet broadcast and the whole subnet broadcast. The target MAC is unicast, so the router forwards the broadcast. Therefore, vro isolated broadcast is the broadcast with the target MAC as full 1. For the target MAC as unicast upper-layer broadcast, vrouters cannot be isolated.


  5. How can I change the source/destination IP address when IP packets are forwarded through a route?

    A -- (B1-B2) -- (C1-C2) -- E

    The preceding topology is used as an example. B1 and B2 are the two interfaces on vrob B, C1 and C2 are the two interfaces on vroc C, and A and E are the PCs, when host A sends data packets to host E, the destination IP address of the data packet formed by host A is the IP address of E, and the source IP address is the IP address of host, the target MAC address is the MAC address of B1, and the source MAC address is the MAC address of.

    After A is re-encapsulated, the source IP address and target IP address remain unchanged. The source MAC address is changed to the B2 MAC address, and the target MAC address is changed to the C1 MAC address, after the package is encapsulated and sent to router C, router C performs the same operations as B after receiving the data packet. The source IP address and the target IP address remain unchanged, and the source MAC address is changed to the C2 MAC address, the target MAC address is changed to the MAC address of host E and then sent to host E so that E receives the packet, when A data packet is restored, the source IP address host A of the received data packet and the MAC address of the source MAC address interface C2 are used as the target IP address and target MAC address.


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.