centos网络配置

网卡(eth0启用/停止)

ifconfig  eht0  up/down

 

设置固定ip:

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

BOOTPROTO='static'

ONBOOT='yes'

STARTMODE='auto'

IPADDR='192.168.1.150/24'

GATEWAY='192.168.1.1'

 

重启网络服务:

service network restart

 

查看防火墙状态:

service  iptables  status

 

关闭防火墙:

service  iptables  stop

 

设置开机关闭防火墙:

chkconfig  iptables  off

 

查看防火墙开机状态:

chkconfig  iptables  --list

chkconfig  --list | grep  iptables

 

修改主机名:

vi  /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=cobub01

 

 

 

 

 

 

猜你喜欢

转载自oitebody.iteye.com/blog/2230914