IP_Network_DefaultGateway

文章解释了默认网关在数据包传输中的作用,区分了同一子网和不同子网的情况,以及源主机如何通过ARP和默认网关进行通信。通过简单网络示例展示了默认网关在不同场景下的操作过程。

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.

 

IP_DefaultGateWay_01.png

 

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生成)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值