前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Vmware 网卡设置

Vmware 网卡设置

作者头像
DataScience
发布2019-12-30 11:31:09
2.1K0
发布2019-12-30 11:31:09
举报
文章被收录于专栏:A2DataA2Data
生活

就是一系列下定决心的努力

· 正 · 文 · 来 · 啦 ·

很多时候我们玩虚拟机想要设置成自己想要的IP网段,但是呢?

又想联网?比如ping 百度 等等

如何将自己的虚拟服务器设置成❤咦的ip呢。

centos7 ping: www.baidu.com: Name or service not known

虚拟机网卡设置

1、网络配置查看

1.1.虚拟机网络设置

记住NAT设置中的子网IP、子网掩码、网关IP三项,接下来配置文件主要是这三项。

2、编辑Linux中的网络配置文件

vi /etc/sysconfig/network-scripts/ifcfg-ens32 #注 网络配置文件名可能会有不同,在输入到ifcfg时,可以连续按两下tab键,获取提示,比如我的机器 为 ifcfg-ens32

代码语言:javascript
复制
TYPE=Ethernet
BOOTPROTO=static #静态连接
DEFROUTE=yes
NAME=ens32
UUID=3391c8af-f6b4-4271-861b-66e12c95d743
DEVICE=ens32
ONBOOT=yes #网络设备开机启动
IPADDR=192.168.56.4
NETMASK=255.255.255.0 #子网掩码
PREFIX=24
GATEWAY=192.168.56.2 #网关IP
DNS1=8.8.8.8
DNS2=8.8.8.4

3、查看网络配置

4、重启网络服务

代码语言:javascript
复制
[root@localhost ~]# service network restart
Restarting network (via systemctl):                        [  OK  ]

5、测试效果

代码语言:javascript
复制
[root@localhost ~]# ping 115.239.210.27
PING 115.239.210.27 (115.239.210.27) 56(84) bytes of data.
64 bytes from 115.239.210.27: icmp_seq=1 ttl=128 time=31.1 ms
64 bytes from 115.239.210.27: icmp_seq=2 ttl=128 time=36.9 ms

6、DNS文件配置(上一步失败)

代码语言:javascript
复制
vi /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 8.8.4.4

7、测试

代码语言:javascript
复制
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=128 time=14.5 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=128 time=7.32 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=128 time=5.70 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=4 ttl=128 time=4.49 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=5 ttl=128 time=4.04 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=6 ttl=128 time=9.78 ms
^Z
[3]+  Stopped                 ping www.baidu.com
[root@localhost ~]# ping www.biying.com
PING a-0001.a-msedge.net (204.79.197.200) 56(84) bytes of data.
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=1 ttl=128 time=43.7 ms
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=2 ttl=128 time=42.9 ms
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=3 ttl=128 time=51.0 ms
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=4 ttl=128 time=48.0 ms
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=5 ttl=128 time=44.8 ms
64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=6 ttl=128 time=42.5 ms
^Z
[4]+  Stopped                 ping www.biying.com

搞定,ok 上网成功~

‘ 所谓成功 ’

坚持把简单的事情做好就是不简单

坚持把平凡的事情做好就是不平凡

每个人都有潜在的能量,只是很容易--

被习惯所掩盖,

被时间所迷离,

被惰性所消磨。

那么,成功呢?就是在平凡中做出不平凡的坚持

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-11-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 DataScience 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档