windows上ping不通VM中的Centos
1、关闭centos的selinux和firewalld
[root@bogon ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
-------------------------close firewalld---------------------------
systemctl disable firewalld
systemctl stop firewalld
2、查看centos机器IP,为vm添加网关
[root@bogon ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:c2:a3:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.248.137/24 brd 192.168.248.255 scope global noprefixroute dynamic ens33
valid_lft 1632sec preferred_lft 1632sec
inet6 fe80::5377:d72e:f958:d1a9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3、在windows上可以ping通centos了
C:\WINDOWS\system32>ping 192.168.248.137
正在 Ping 192.168.248.137 具有 32 字节的数据:
来自 192.168.248.137 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.248.137 的回复: 字节=32 时间<1ms TTL=64