您的位置:首页 > 运维架构 > Linux

虚拟机桥接模式-CentOS下配置静态IP

2016-03-16 00:00 726 查看
摘要: VMware安装Centos选择网络模式为桥接模式,就相当于该虚拟机为一台真实的物理机。

注意事项:

centos6.5系统下,修改etc/sysconfig/network-script下的ifcg-eth0文件
centos7系统及以上,修改etc/sysconfig/network-script下的ifcg-16777736文件

配置步骤:

一、打开目录Terminal终端,进入目录etc/sysconfig/network-script/下

[root@localhost Desktop]# cd /etc/sysconfig/network-scripts/


二、编辑ifcfg-eth0文件 vi ifcfg-eth0

1、修改配置:

BOOTPROTO="static"
ONBOOT="yes"


2、添加配置:(如果需要连接外网,把DNS改为你的主机的DNS即可)

IPADDR=192.168.1.111
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.8.8


三、重启网络服务

[root@localhost Desktop]# service network restart
Shutting down interface eth0:  Device state: 3 (disconnected)
[  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/20
state: activated
Connection activated
[  OK  ]


四、测试,收到数据即配置完成!

[root@localhost network-scripts]# ping
PING www.a.shifen.com (119.75.217.109) 56(84) bytes of data.
64 bytes from 119.75.217.109: icmp_seq=1 ttl=55 time=1.52 ms
64 bytes from 119.75.217.109: icmp_seq=2 ttl=55 time=1.67 ms
64 bytes from 119.75.217.109: icmp_seq=3 ttl=55 time=1.89 ms
64 bytes from 119.75.217.109: icmp_seq=4 ttl=55 time=1.99 ms
64 bytes from 119.75.217.109: icmp_seq=5 ttl=55 time=1.84 ms
64 bytes from 119.75.217.109: icmp_seq=6 ttl=55 time=1.71 ms
64 bytes from 119.75.217.109: icmp_seq=7 ttl=55 time=1.98 ms
64 bytes from 119.75.217.109: icmp_seq=8 ttl=55 time=1.86 ms
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  centos ip 网络配置