NETWORK ENGINEER BLOG

Tips and Reviews for Engineers

CentOS6 の基本的な設定について

CentOS6 の基本設定

ホスト名の変更

network ファイルの localhost を任意の名前に変更します。

[root@hostname ~]# diff /etc/sysconfig/network.orig /etc/sysconfig/network
2c2
< HOSTNAME=localhost.localdomain
---
> HOSTNAME=centos-6.localdomain

hosts ファイルの localhost を任意の名前に変更します。

[root@hostname ~]# diff /etc/hosts.orig /etc/hosts
1,2c1,2
< 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
< ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
---
> 127.0.0.1   centos-6 centos-6.localdomain centos-64 centos-64.localdomain4
> ::1         centos-6 centos-6.localdomain centos-66 centos-66.localdomain6

再起動します。

[root@hostname ~]# shutdown -r now
ルートの追加

出力インターフェース(例:eth2)を指定した route-eth2 ファイルを作成し、編集します。

[root@hostname ~]# vi /etc/sysconfig/network-scripts/route-eth2
172.16.1.0/24 via 10.1.1.254

ネットワークを再起動します。

[root@hostname ~]# /etc/rc.d/init.d/network restart

ルート情報の確認をします。

[root@hostname ~]# netstat -rn
ファイアウォールの無効化

ファイアウォールを停止します。

[root@hostname ~]# /etc/rc.d/init.d/iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]

ファイアウォールの自動起動を無効化します。

[root@hostname ~]# chkconfig iptables off
SELinux の無効化

SELinux を無効化します。

[root@hostname ~]# set enforce 0

SELinux の状態を確認します。

[root@hostname ~]# getenforce
Permissive

SELinux を永久に無効化します。

[root@hostname ~]# cat /etc/selinux/config
SELINUX=disabled

以上