VMware ubuntu 虚拟机网络连接

win10 VMware 虚拟机 实现桥接模式 
VMware的桥接模式,可以让大家像拥有另外一台不同操作系统的电脑一样在局域网中。同样可以来上网,可以和局域网中的其他机器一样通信,甚至可以暴露ip与端口到公网中,这样其他机器或者网页等也能访问它。
环境:
宿主机:win10
软件:VMware
虚拟机:Ubuntu 18.04
前提条件:已经在宿主机中安装好了虚拟主机Ubuntu
一、查看物理机(宿主机)在局域网内的信息
点击WIFI图标,右击 打开网络和internet设置,点击详细信息,不要勾选共享。

 
三、设置虚拟机,需要在关闭虚拟机


桥接到的网络为详细信息连接的网络。

在这里插入图片描述

四、现在进行开机,进到虚拟机中设置 ,这是可视化的设置

1、配置静态IP地址:

 运行ifconfig 查看连接

 或者 ip a

看到为ens33

sudo gedit /etc/network/interfaces

原内容有如下4行:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

以上表示默认使用DHCP分配IP,修改为如下:(地址与win10后三位不同,其他一样)

auto lo
iface lo inet loopback

auto ens33
iface ens33 inet static
address 192.168.31.113
netmask 255.255.255.0
gateway 192.168.31.1

保存退出。
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,

1点击save保存,查看设置结果,ctrl+alt+t 可以呼出终端 输入ifconfig 查看虚拟机的IP地址

可以看到设置成功, 现在进行ping 操作,ping www.baidu.com,如果不成功进行下面操作。

sudo gedit /etc/systemd/resolved.conf

 修改为以下内容

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes


 

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值