码迷,mamicode.com
首页 > 其他好文 > 详细

Liunx配置 IP 地址和DNS服务器

时间:2015-05-29 18:35:05      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:config linux ip


进入linux网卡目录

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

 DEVICE="eth0"

HWADDR="8E:1A:DD:9A:1C:B7"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=192.168.8.2
NETMASK=255.255.255.0
GATEWAY=192.168.8.254

保存:wq

[root@localhost ~]# /sbin/service network restart
Shutting down loopback interface:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]

ping 测试

[root@localhost ~]# ping 192.168.8.1
PING 192.168.8.1 (192.168.8.1) 56(84) bytes of data.
64 bytes from 192.168.8.1: icmp_seq=1 ttl=64 time=3.18 ms
64 bytes from 192.168.8.1: icmp_seq=2 ttl=64 time=0.647 ms
64 bytes from 192.168.8.1: icmp_seq=3 ttl=64 time=0.684 ms

配置DNS服务器

[root@localhost ~]# vi /etc/resolv.conf

nameserver 192.168.8.221

保存:wq

ping ww.baidu.com

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (119.75.217.56) 56(84) bytes of data.
64 bytes from 119.75.217.56: icmp_seq=1 ttl=54 time=27.5 ms
64 bytes from 119.75.217.56: icmp_seq=2 ttl=54 time=27.8 ms


本文出自 “Liy-L” 博客,请务必保留此出处http://liy116.blog.51cto.com/2991406/1656339

Liunx配置 IP 地址和DNS服务器

标签:config linux ip

原文地址:http://liy116.blog.51cto.com/2991406/1656339

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!