Linux设置静态IP

查看IP信息:
[root@localhost ~]# ifconfig
 
# IP配置文件
/etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# cd /etc/sysconfig/network-scripts
[root@localhost ~]# vi ifcfg-eth0
原内容:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:03:47:2C:D5:42 (网卡Mac地址)
ONBOOT=yes
TYPE=Ethernet
 
改为:
DEVICE=eth0
BOOTPROTO=static
IPADDR=10.8.8.8
NETMASK=255.255.0.0
GATEWAY=10.8.0.1
HWADDR=00:03:47:2C:D5:42 (网卡Mac地址)
ONBOOT=yes
TYPE=Ethernet
 
# 重启网卡使设置生效:
[root@localhost ~]# /sbin/ifdown eth0
[root@localhost ~]# /sbin/ifup eth0
[root@localhost ~]# /etc/init.d/network restart 
 
# 防火墙设置
[root@localhost bin]# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
service iptables start/stop/restart/status

# 服务管理
chkconfig --list
chkconfig --help
 
 

posted on 2012-11-21 10:30  nobyte  阅读(298)  评论(0)    收藏  举报

导航