首页 > 其他 > 详细

Centos6.6网络配置方法

时间:2015-10-28 07:08:11      阅读:386      评论:0      收藏:0      [点我收藏+]

一、桥接模式设置方法


[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




本文出自 “努力哥Linux运维” 博客,请务必保留此出处http://nulige.blog.51cto.com/10827858/1706970

Centos6.6网络配置方法

原文:http://nulige.blog.51cto.com/10827858/1706970

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!