知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

Centos6.6网络配置方法

发布时间:2015-11-06 16:47:58作者:知识屋

一、桥接模式设置方法
 
[root@Centos66 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes  
NM_CONTROLLED=yes
BOOTPROTO=dhcp
HWADDR=00:0c:29:8d:e8:5b
DNS1=8.8.8.8
USERCTL=no
PEERDNS=yes
IPV6INIT=no
 
[root@Centos66 ~]# /etc/init.d/network restart
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  
Determining IP information for eth0... done.
[  OK  ]
 
二、NAT—静态ip地址配置上网
 
先设置网卡为NAT模式 
[root@Centos66 ~]#vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.15
NETMASK=255.255.255.0
GATEWAY=192.168.0.2
HWADDR=00:0c:29:8d:e8:5b
DNS1=8.8.8.8
USERCTL=no
PEERDNS=yes
IPV6INIT=no
 
[root@Centos66 ~]# /etc/init.d/networkrestart
Shutting down interface eth0:  [ OK  ]
Shutting down loopback interface:  [ OK  ]
Bringing up loopback interface:  [ OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.0.15 isalready in use for device eth0...
[ OK  ]
 
[root@Centos66 ~]# ping www.baidu.com
PING www.a.shifen.com (112.80.248.74)56(84) bytes of data.
64 bytes from 112.80.248.74: icmp_seq=1ttl=128 time=45.2 ms
64 bytes from 112.80.248.74: icmp_seq=2ttl=128 time=45.5 ms
64 bytes from 112.80.248.74: icmp_seq=3ttl=128 time=48.0 ms
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜