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?

More than 3 years have passed since last update.

CentOS7: IPアドレスの固定とIT IS POSSIBLE ~

Last updated at Posted at 2020-06-09

IPアドレスを固定

/etc/sysconfig/network-scripts/ifcfg-ens{xxx}
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-ens{xxx}
# #編集
ONBOOT=yes <- 起動時にネットワークを有効化
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.{xxx} <- 固定したいIPアドレス
PREFIX=24
GATEWAY=192.168.0.{xx} <- ルーターアドレス
DNS1=192.168.0.{xx} <- ルーターアドレス
DNS2=8.8.8.8

BROADCASTはIPアドレスの全ホストにパケット送信できるアドレス(アドレスの末尾)。192.168.0.[255]
PREFIXはIPアドレスのどの部分がネットワーク部分であるか?というサブネットマスクの省略形のようなもの。[192.168.0]の部分。

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

何度もIPアドレスの変更をしてて上のエラーがでたら、操作しているクライアントPCに保存されているホスト鍵に問題があります。

$HOME/.ssh/known_hosts

クライアントPCに保存されている上記のファイルの該当するIPアドレスを削除してあげるとエラーもでなくなります!

ついでにHostnameも変更しとく?

$ sudo hostnamectl set-hostname {新ホスト名}
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?