Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
58
Help us understand the problem. What is going on with this article?
@yunano

CentOS 7.1.1503ではnmcliでIPアドレスを固定する方法が変更された

More than 5 years have passed since last update.

CentOS 7.0.1406 (NetworkManager 0.9.9.1)ではnmcliを使ってNICに固定IPアドレスを設定するには次のようなコマンドを実行した。

# nmcli connection modify enp0s8 ipv4.method manual ipv4.addresses "10.0.2.250/24 10.0.2.1" ipv4.dns 8.8.8.8

この後、「systemctl restart network.service」などで反映される。

しかし、CentOS 7.1.1503 (NetworkManager 1.0.0)では同じnmcliコマンドを実行するとエラーになる。

# nmcli connection modify enp0s8 ipv4.method manual ipv4.addresses "10.0.2.250/24 10.0.2.1" ipv4.dns 8.8.8.8

Error: failed to modify ipv4.addresses: invalid prefix '24 10.0.2.1'; <1-32> allowed.

結局のところ、従来なかった「ipv4.gateway」プロパティが増えているので以下のようにすればよい。

# nmcli connection modify enp0s8 ipv4.method manual ipv4.addresses 10.0.2.250/24 ipv4.gateway 10.0.2.1 ipv4.dns 8.8.8.8

まあ、この指定の仕方のほうがすっきりしてると思うけどね。

58
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
yunano
simpline
AWSを強みとしたインフラエンジニアリング/IaaSコスト削減サービスを提供しているSIer

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
58
Help us understand the problem. What is going on with this article?