gpt4 book ai didi

linux - 路由命令输出

转载 作者:太空狗 更新时间:2023-10-29 12:12:46 24 4
gpt4 key购买 nike

路由命令输出:

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.2.10 0.0.0.0 UG 0 0 0 eth0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
$

从上面的输出来看,我的疑惑如下:

  1. 目标和网关列中的 0.0.0.0 是什么意思
  2. 如果数据包是从 192.168.2.36 ip 发送的,那么它的网关是什么。它使用 192.168.2.10 或 0.0.0.0
  3. 假设我还有一个 IP 为 192.168.1.0 的网络。如果数据包是从这个网络的任何主机发送的,那么是什么该 IP 的网关。
  4. 什么是默认网关。

最佳答案

  1. 第一行,Genmask 中的 0.0.0.0 表示没有掩码,即结合 destination 0.0.0.0,表示全部目的地(默认网关定义)。第二行gateway一栏0.0.0.0表示没有网关(直连本地子网)。

  2. 路由时,发送到哪里并不重要,发送到哪里并不重要。

  3. 发送到网络 192.168.1.0 的数据包将使用网关 192.168.2.10 进行路由,因为第一行是唯一与目标 192.169.1.0 匹配的行。

  4. 192.168.2.10(见答案 1)。

关于linux - 路由命令输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36515518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com