进入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
原文地址:http://liy116.blog.51cto.com/2991406/1656339