VMware虚拟机连接网络

nat模式

linux

直接打开虚拟机设置
在这里插入图片描述
将网络适配器改为NAT模式,然后确认。

BOOTPROTO=dhcp

网卡获取IP方式为dhcp,若为static,则在修改后重启服务。

[root@linus ~]# systemctl restart network

再次查看ip地址,获得的就是dhcp自动获取的IP地址

[root@linus ~]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.125.128  netmask 255.255.255.0  broadcast 192.168.125.255
        inet6 fe80::f57d:1893:a2d4:f779  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:78:27:b4  txqueuelen 1000  (Ethernet)
        RX packets 1385  bytes 144550 (141.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 895  bytes 126963 (123.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

检查网络连通性

[root@linus ~]# ping -c 3 www.baidu.com
PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=128 time=21.6 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=128 time=22.1 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=128 time=22.5 ms

--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 21.674/22.123/22.535/0.372 ms

windwos

老样子
在这里插入图片描述
将网卡地址获取方式改为dhcp自动获取
在这里插入图片描述
测试连通性

C:\Users\hauwei>ping www.baidu.com

正在 Ping www.a.shifen.com [39.156.66.18] 具有 32 字节的数据:
来自 39.156.66.18 的回复: 字节=32 时间=23ms TTL=128
来自 39.156.66.18 的回复: 字节=32 时间=23ms TTL=128
来自 39.156.66.18 的回复: 字节=32 时间=22ms TTL=128
来自 39.156.66.18 的回复: 字节=32 时间=22ms TTL=128

39.156.66.18 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 22ms,最长 = 23ms,平均 = 22ms

桥接模式

在这里插入图片描述
只需将网络适配器改为桥接即可,其他配置与nat模式一样

仅主机模式

仅可以与主机通信,也不能访问外网

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虚伪的空想家

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值