3
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 5 years have passed since last update.

CentOS7 ネットワーク設定

Last updated at Posted at 2016-08-11

概要

CentOS7のネットワーク設定は、CentOS6以前と設定方法やコマンドが変更されているので、設定手順を記録しておく。

IPv6の無効化

以下の設定ファイルを修正し、IPv6を無効化する。

IPアドレスの確認
ip address show

<出力結果>
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:9d:b0:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.xx/24 brd 192.168.10.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 2407:c800:531e:d200:a00:27ff:fe9d:b09e/64 scope global mngtmpaddr dynamic
       valid_lft 86387sec preferred_lft 86387sec
    inet6 fe80::a00:27ff:fe9d:b09e/64 scope link
       valid_lft forever preferred_lft forever
設定ファイルのバックアップ
sudo cp -piv /etc/sysctl.conf /etc/sysctl.conf.`date "+%Y%m%d"`

<出力結果>
`/etc/sysctl.conf' -> `/etc/sysctl.conf.YYYYMMDD`

以下の「IPv6 Disable」のように設定ファイルに追記する。

/etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
### IPv6 Disable begin
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
### IPv6 Disable end
設定ファイルの反映
sudo sysctl -p

<出力結果>
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

以下のコマンドで、inet6の設定が消えていることを確認する。

IPアドレスの確認
ip address show

<出力結果>
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:9d:b0:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.xx/24 brd 192.168.10.255 scope global enp0s3
       valid_lft forever preferred_lft forever

次の手順

CentOS7 パッケージ管理(yum)の設定

以上

3
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
3
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?