Linux CentOs6.4 静态IP 设置

 

Linux CentOs6.4 静态IP 设置

分类: IT技术   2330人阅读  评论(1)  收藏  举报

To do that, just log on as root and change directory to /etc/sysconfig/network-scripts/ to view all available devices.

# cd /etc/sysconfig/network-scripts/

You need to edit following files:

  • /etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
  • /etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file

To edit/create first NIC file, type command:

# vi ifcfg-eth0

Append/modify as follows:

DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=192.168.0.10
NETMASK=255.255.255.0
ONBOOT=yes

Save and close the file.

After that, configure the default gateway (router IP) and hostname in /etc/sysconfig/network file:

# vi /etc/sysconfig/network

Append/modify configuration as follows:

NETWORKING=yes
HOSTNAME=techkaki
GATEWAY=192.168.0.1

Save and close the file. Restart networking by enter following command:

# /etc/init.d/network restart

Make sure you have correct DNS server defined in /etc/resolv.conf file:

# vi /etc/resolv.conf

Setup DNS Server as follows:

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 202.67.222.222

Save and close the file. Now you can ping the gateway/other hosts:

$ ping 192.168.0.1

posted @ 2014-03-07 23:28  太阳神LoveU  阅读(5)  评论(0编辑  收藏  举报  来源