Total Pageviews

Monday 26 August 2024

Linux Networking Commands


在很多linux发行版中经典的 ifconfig 等命令不再预装,取而代之的是 ip 命令,该指令属于 iproute2 包。本文介绍一下常见的网络层/传输层命令。


`ifconfig’ Related

Deprecated Replacement

ifconfig ip a or ip addr

ifconfig <interface> ip a show dev <interface>

ifconfig <interface> add <address>[</mask>] ip a add <address>[</mask>] dev <interface>

ifconfig <interface> mtu <mtu> ip link set dev <interface> mtu <mtu>


`route’ Related

Deprecated Replacement

route ip route

route add <dest> <gateway> [<netmask>] ip route add <dest>[/<mask>] via <gateway>

route get <dest> ip route get <dest>


`netstat’ Related


替换 netstat 的是 ss 命令,两个命令的参数几乎一样,这里就用作者常用的几个举例子。

Deprecated Replacement

netstat -nlt ss -nlt

netstat -nat ss -nat

No comments:

Post a Comment