https://www.sharetechnote.com/html/IP_Network_DefaultGateway.html
Default Gateway
Default Gateway is a kind of Gateway you specify on your PC (or any host) by which any packet goes through to reach another PC (or another host) which is not in the same subnet as your PC.
Definition would sound simple, but it would be difficult to understand the concept without trying yourself or some simple examples.
Let's assume that we have very simple networks as illustrated below.

Case 1 >
PC (A) tries to send a packet to PC (C). The overall procedure for this traffic would be as follows.
i) The source (PC (A)) checks the destination IP (PC (C)) and find out that the destination IP belong to the same subnet. (It means it does not need to consult to 'Default Gateway' to reach the destination).
ii) The source checks its ARP table to figure out the MAC address of the destination.
-
a) If the destination IP and MAC address mapping is already stored in the ARP table, the source send the packet directly to the destination
b) If the destination IP and MAC address mapping is already not stored in the ARP table, the source performs ARP procedure and figure out the destination MAC address and then send the packet to the destination.
Case B >
PC (A) tries to send a packet to PC (E). The overall procedure for this traffic would be as follows.
i) The source (PC (A)) checks the destination IP (PC (E)) and find out that the destination IP does not belong to the same subnet. (It means it need the help of 'Default Gateway' to reach the destination).
ii) The source send the packet to the default Gateway (GW1 in this case) and the default Gateway handles all the remaining procedure to deliver the packet to the destination. (In terms of the default Gateway, it may have to go through several additional steps to deliver the data to the next node, but in terms of host. It is so simple as explained here. Just send the packet to Default Gateway).
默认网关
默认网关是在您的PC(或任何主机)上指定的网关,任何数据包都通过它到达与您的PC不在同一子网的另一个PC(或其他主机)。
定义听起来很简单,但要理解这个概念,您需要尝试一下或看一些简单的例子。
让我们假设我们有以下非常简单的网络。
情况1 >
PC(A)试图向PC(C)发送数据包。此流量的总过程如下。
i) 源(PC(A))检查目标IP(PC(C)),发现目标IP属于同一子网。(这意味着它不需要咨询“默认网关”即可到达目标)。
ii) 源检查其ARP表以找出目标的MAC地址。
a) 如果目标IP和MAC地址映射已存储在ARP表中,源直接将数据包发送到目标。
b) 如果目标IP和MAC地址映射尚未存储在ARP表中,源执行ARP过程并找出目标MAC地址,然后向目标发送数据包。
情况B >
PC(A)试图向PC(E)发送数据包。此流量的总过程如下。
i) 源(PC(A))检查目标IP(PC(E)),发现目标IP不属于同一子网。(这意味着它需要“默认网关”的帮助才能到达目标)。
ii) 源将数据包发送到默认网关(在这种情况下为GW1),默认网关处理所有剩余的过程以将数据包送达目的地。(对于默认网关来说,它可能需要经过几个额外的步骤才能将数据传递到下一个节点,但对于主机来说,非常简单。只需将数据包发送到默认网关)。
(内容由讯飞星火AI生成)
文章解释了默认网关在数据包传输中的作用,区分了同一子网和不同子网的情况,以及源主机如何通过ARP和默认网关进行通信。通过简单网络示例展示了默认网关在不同场景下的操作过程。
594

被折叠的 条评论
为什么被折叠?



