首页 > 代码库 > 修改Linux基本配置

修改Linux基本配置

1.修改主机名

vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=server1.cn

2.修改ip地址

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

BOOTPROTO=static

IPADDR=192.168.0.101

NETMASK=255.255.255.0

service network restart

3.修改ip地址和主机名的映射关系

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.101 server1.cn

4.关闭iptables并设置其开机启动/不启动

service iptables stop

chkconfig iptables on

chkconfig iptables off

修改Linux基本配置