よく使う便利なネットワークコマンドの一覧
※UbuntuなどのLinux環境では、従来の「net-tools」パッケージ(ifconfig / arp / netstat / route など)が非推奨となり「iproute2」パッケージへ移行している。
なので「ifconfig」などのコマンドは古くもあり、Ubuntuにおいては18.04以降、デフォルトではインストールされていない。「ifconfig」コマンドを使用するには「net-tools」パッケージをインストールする必要がある。
net-toolsのインストール
$ sudo apt install net-tools
| Windows | Linux |
|---|---|
| ipconfig ipconfig /all(詳細) Get-NetIPAddress(PowerShell) | 【旧】ifconfig(net-tools) 【新】ip addr show / ip a(iproute2) |
| Windows | Linux |
|---|---|
| ping 接続先 ping -t 接続先(連続実行) Test-NetConnection 接続先 -Port ポート番号(PowerShell) | ping 接続先 ping -c 回数 接続先(回数指定) |
| Windows | Linux |
|---|---|
| tracert 接続先 tracert -d 接続先 | 【旧】traceroute 接続先 【新】tracepath 接続先 |
| Windows | Linux |
|---|---|
| hostname | hostname hostnamectl(詳細) |
| Windows | Linux |
|---|---|
| arp -a | 【旧】arp -a / arp -n(net-tools) 【新】ip neigh show / ip n(iproute2) |
| Windows | Linux |
|---|---|
| nslookup ドメイン名 Resolve-DnsName ドメイン名(PowerShell) | 【旧】nslookup ドメイン名 【旧】host ドメイン名 【新】dig ドメイン名 |
| Windows | Linux |
|---|---|
| route print netstat -r | 【旧】route -n(net-tools) 【旧】netstat -rn(net-tools) 【新】ip route show / ip r(iproute2) |
| Windows | Linux |
|---|---|
| netstat -ano Get-NetTCPConnection(PowerShell) | 【旧】netstat -tulnp(net-tools) 【新】ss -tulnp(iproute2) |
| Windows | Linux |
|---|---|
| Test-NetConnection 接続先 -Port ポート番号(PowerShell) curl -I <URL>(HTTPヘッダ確認) | telnet 接続先 ポート番号 curl -I <URL>(HTTPヘッダ確認) |
| Windows | Linux |
|---|---|
| ipconfig /displaydns(キャッシュ表示) ipconfig /flushdns(キャッシュクリア) | resolvectl status(systemd-resolved環境の確認) resolvectl flush-caches(キャッシュクリア) |