ubuntu查看网络相关信息

  • 查看ip地址和网卡:ifconfig
    需要确保下载了net-toolssudo apt install net-tools

  • 查看DNS:resolvectl status(下图中DNS Servers就是的)
    ubuntu查看网络相关信息_第1张图片

  • 查看网关:route -n
    该命令会显示当前系统的路由表信息,其中包含了网关的IP地址。在输出结果中,我们可以找到一行以“0.0.0.0”开头的记录,该记录表示默认路由,对应的网关IP地址就是当前系统的网关。

  • 查看subnet:参考自subnetcalc

sudo apt install subnetcalc
# subnetcalc [Address] [Netmask/Prefix] [-n] [-uniquelocal] [-uniquelocalhq]
# subnetcalc 132.252.250.0 255.255.255.0
# subnetcalc 132.252.250.0/255.255.255.0
# subnetcalc 132.252.250.0 24
# subnetcalc 132.252.250.0/24
# subnetcalc fec0:2345:6789:1111:221:6aff:fe0b:2674 56
# subnetcalc 2a00:1450:8007::69 64
# subnetcalc ff08::1:2:3
# subnetcalc 131.220.6.5/24
# subnetcalc 132.252.181.87 -n
# subnetcalc www.iem.uni-due.de 24
# subnetcalc www.six.heise.de
# subnetcalc fd00:: 64 -uniquelocal
# subnetcalc fd00::9876:256:7bff:fe1b:3255 56 -uniquelocalhq
# subnetcalc düsseldorf.de 28
# subnetcalc www.köln.de
# subnetcalc räksmörgås.josefsson.org 24
subnetcalc 172.30.154.84 24

你可能感兴趣的:(ubuntu,网络,linux)