1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ネットワーク管理関連のコマンドまとめ(個人メモ)

1
Posted at

はじめに

ネットワーク管理系のコマンドがたくさんあって混乱したので、
整理してみました。
Linuxでは、

  • 一時的な設定・永続的な設定
  • 旧方式・新方式

が混在していて、全体像が見えにくくなりがちです。
この記事では、その違いをシンプルにまとめています。

ネットワーク管理系のコマンド

ネットワーク管理コマンドは大きく分けると、

  • 一時的な管理(ランタイム変更)
  • 永続的な管理(設定の保存)

の2種類があります。

永続的(再起動しても残る)

昔は/etc/sysconfig/...などの設定ファイルを編集するのが標準でした。
例(RHEL系):

/etc/sysconfig/network-scripts/ifcfg-ens33

現在ではネットワークマネージャでの管理が標準です。
操作コマンド:

nmcli
nmtui

つまり、

  • 昔 → 設定ファイルを手で編集
  • 今 → NetworkManagerで管理

という違いがあります。

一時的

一時的な設定は、カーネルのネットワーク情報を直接変更します。

ネットワーク管理について、
昔は1990年台に設計されたnet-toolsと呼ばれるコマンドが使われていました。
例)ifconfig, route, ifup/ifdown
しかしその後、

  • IPv6対応
  • 複雑なルーティング
  • 名前空間(namespace)対応

などの進化に十分に対応できなくなり、現在の標準ネットワークツール群であるiproute2が登場しました。
例)ip, ss, tc
こちらではコマンドがipに統合されているのが特徴です。

旧:

ifconfig
route
arp

新:

ip addr
ip route
ip neigh

新旧コマンド比較図

項目 旧方式 新方式(推奨)
IP確認 ifconfig ip addr
IP設定 ifconfig nmcli
インタフェースUP/DOWN ifconfig up/down ip link
GW確認 route -n ip route
GW設定 route add ip route add
ホスト名変更 hostname hostnamectl

ポイント

  • 今は ip コマンドが標準
  • route / ifconfig は非推奨(net-tools)
  • 今の標準はiproute2➕NetworkManager

まとめ

カテゴリ分けして覚える!

旧方式 新方式(現在の標準)
一時設定 net-tools(ifconfig, route) iproute2(ipコマンド)
永続設定 /etc/sysconfig/... を手動編集 NetworkManager(nmcli)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?