Linux/CentOS设置ip地址及DNS

2010-07-07 15:48:12 by sand, 1297 visits, Tags: dns, Linux,

 操作系统:Linux Cent OS 5 

  1. 设置静态ip地址:
    nano /etc/sysconfig/network-scripts/ifcfg-eth0
    
    DEVICE=eth0
    BOOTPROTO=static
    HWADDR=00:F1:F3:07:11:4A
    ONBOOT=yes
    DHCP_HOSTNAME=ehangpc
    TYPE=Ethernet
    NETMASK=255.255.255.0
    IPADDR=192.168.1.2
    GATEWAY=192.168.1.1
  2. 设置DNS:
    nano /etc/resolv.conf
    
    nameserver 8.8.8.8
  3. 重启网络服务使配置生效:
    service network restart
    

评论 (2)