2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

nmcliでルーティングテーブルを追加[CentOS/RHEL]

Posted at

CentOS7やRHEL7からNetworkManagerでネットワーク周りを管理するようになった。
管理の時に使うコマンドはnmcliです。
今まではルーティングテーブルを追記する時は、/etc/sysconfig/network-script/route-ethXXXを追加していたが、nmcliを使えば必要なかった。

ルーティングテーブルを追加

nmcli conn mod eth0 +ipv4.routes "172.18.0.0/16 10.10.1.254"

ルーティングテーブルを確認

nmcli connection show eth0 | grep IP4.ROUTE

以下出力例

IP4.ROUTE[1]:                           dst = 10.XX.XX.XX/16, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                           dst = 172.18.0.0/16/16, nh = 10.10.1.254, mt = 100
2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?