本地安装了VMware虚拟机
1 配置主机虚拟网卡VMnet8
网络中心 ----> 更改适配器选项
VMnet8 禁用—> 启用
2 配置VMware虚拟机
root登录,并修改虚拟机信息:
[root@base100 ~]# echo node130 > /etc/hostname
[root@base100 ~]# cat /etc/hostname
node130
[root@base100 ~]# echo 192.168.6.130 node130 >> /etc/hosts
[root@base100 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.6.130
# 必须跟VMnet8中的网关地址一致
GATEWAY=192.168.6.2
DNS1=192.168.6.2
重启虚拟机
3 关闭两端防火墙
3.1 关闭Win系统的防火墙
3.2 关闭虚拟机中的防火墙
systemctl status firewalld
4 网络测试
# 虚拟机中ping外网
ping www.baidu.com
# 虚拟机中ping主机(主机就是VMnet8的IP地址)
ping 192.168.6.1
# 主机上ping虚拟机
ping 192.168.6.130
都能ping通,说明网络配置已OK。至此,已可以使用SSH远程连接。
- 能Ping通主机, 但Ping不通baidu。检查 ens33中IPADDR和GATEWAY
- 能Ping通baidu, 但Ping不通主机。 检查 windows防火墙没关
- 能Ping通主机, 但Ping外网时。 报网络不可达 或 拒绝连接 原因是网关错误
- 发现哪都没错,就是上不了网
systemctl stop NetWorkManager
systemctl disable NetWorkManager
systemctl restart network