VMware:NAT联网设置与桥接联网设置

目录

一、NAT模式联网

1.设置虚拟机网络适配器,选择自定义VMnet8(NAT模式)

2.修改分配的网段

 3.配置网关地址:192.168.8.254

4.配置虚拟机网络配置

二、桥接模式联网 


一、NAT模式联网

1.设置虚拟机网络适配器,选择自定义VMnet8(NAT模式)

 

2.修改分配的网段

 

 

 3.配置网关地址:192.168.8.254

网关地址可以使当前网段未被占用的任意一个

 

 

 

4.配置虚拟机网络配置

使用nmtui打开系统自带图像页面配置ip地址、网关

 

 

 激活修改的网卡信息

 

 

 设置完毕退出

 

[root@A /]# route –n   #查看网关地址
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.8.254   0.0.0.0         UG    100    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
[root@A /]# ping www.baidu.com   #测试通信
PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.
64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=1 ttl=128 time=4.24 ms
64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=2 ttl=128 time=3.76 ms
64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=3 ttl=128 time=5.43 ms

二、桥接模式联网 

修改虚拟机网卡适配器为桥接模式:

 

将网卡设置成自动获取IP:

[root@localhost ~]# nmcli connection modify eth0 ipv4.method auto  connection.autoconnect yes

[root@localhost ~]# nmcli connection up eth0 

连接已成功激活(D-Bus 活动路径: /org/freedesktop/NetworkManager/ActiveConnection/4)

[root@localhost ~]# ifconfig | head -2

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

    inet 172.40.93.124  netmask 255.255.255.0  broadcast 172.40.93.255

[root@localhost ~]# ping www.baidu.com

PING www.a.shifen.com (182.61.200.6) 56(84) bytes of data.

64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=1 ttl=53 time=4.41 ms

64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=2 ttl=53 time=4.15 ms

64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=3 ttl=53 time=4.32 ms

64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=4 ttl=53 time=4.48 ms

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值