例如
[root@client ~]# curl http://192.168.99.100/
curl: (7) Failed to connect to 192.168.99.100: Network is unreachable
底层网络是否通
[root@client ~]# ping 192.168.99.100
connect: Network is unreachable
[root@client ~]# ip a s #检查IP地址
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:34:14:90 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.10/24 brd 192.168.88.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe34:1490/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:34:14:9a brd ff:ff:ff:ff:ff:ff
[root@client ~]# route -n#检查网关
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
[root@client ~]# nmcli connection modify eth0 ipv4.gateway 192.168.88.5
[root@client ~]# nmcli connection down eth0
Connection ‘eth0’ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
[root@client ~]# nmcli connection up eth0
[root@web1 ~]# nmcli connection modify eth1 ipv4.gateway 192.168.99.5
[root@web1 ~]# nmcli connection down eth1
Connection ‘eth1’ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@web1 ~]#nmcli connection up eth1
[root@web2 ~]# nmcli connection modify eth1 ipv4.gateway 192.168.99.5
[root@web2 ~]# nmcli connection down eth1
Connection ‘eth1’ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@web2 ~]# nmcli connection up eth1
检查防火墙
[root@web1 ~]# systemctl status firewalld
Unit firewalld.service could not be found.#没有防火墙==防火墙已关闭
检查selinux
[root@web1 ~]# getenforce #查看当前运行模式
Disabled
检查服务是否开启
[root@web1 ~]# ss -tlnp | grep :80
LISTEN 0 128 :::80 ::😗 users:((“httpd”,pid=1381,fd=4),(“httpd”,pid=1380,fd=4),(“httpd”,pid=1379,fd=4),(“httpd”,pid=1378,fd=4),(“httpd”,pid=1377,fd=4),(“httpd”,pid=1376,fd=4))