当前位置:   article > 正文

centos 无法ping通本地回环地址_centos ping 本地换回地址

centos ping 本地换回地址

介绍:

客户端可以telnet通服务器的端口,但是无法ping通服务器的IP地址,服务器本身也无法ping通网卡IP和回环地址

一、防火墙排查

1、查看服务器防火墙状态

  1. #服务器本地查看到防火墙是关闭的,排查防火墙配置问题
  2. [root@server ~]# systemctl status firewalld
  3. ● firewalld.service - firewalld - dynamic firewall daemon
  4. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  5. Active: inactive (dead)
  6. Docs: man:firewalld(1)
  7. Apr 26 08:55:35 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
  8. Apr 26 08:55:36 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
  9. Apr 26 09:48:07 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
  10. Apr 26 09:48:09 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

2、在服务器本机ping本身网卡地址和回环地址一样不通

  1. [root@server ~]# ip add
  2. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  3. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  4. inet 127.0.0.1/8 scope host lo
  5. valid_lft forever preferred_lft forever
  6. inet6 ::1/128 scope host
  7. valid_lft forever preferred_lft forever
  8. 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  9. link/ether 00:0c:29:13:29:39 brd ff:ff:ff:ff:ff:ff
  10. inet 192.168.14.211/24 brd 192.168.14.255 scope global noprefixroute ens32
  11. valid_lft forever preferred_lft forever
  12. inet6 fe80::20c:29ff:fe13:2939/64 scope link
  13. valid_lft forever preferred_lft forever

二、内核参数排查

1、查看内核参数ICMP忽略返回数据包,1为开启,0为关闭

  1. [root@server ~]# sysctl -a |grep net.ipv4.icmp
  2. net.ipv4.icmp_echo_ignore_all = 1

2、查看/etc/sysctl.conf 文件,确实有记录

  1. [root@server ~]# cat /etc/sysctl.conf |grep -v ^#
  2. net.ipv4.icmp_echo_ignore_all = 1

3、修改net.ipv4.icmp_echo_ignore_all 把 1 改为 0

  1. [root@server ~]# vi /etc/sysctl.conf
  2. [root@server ~]# sysctl -p
  3. net.ipv4.icmp_echo_ignore_all = 0

4、如果已经把net.ipv4.icmp_echo_ignore_all 从配置文件查看,但是查看内核对应数值还是为1,建议重启服务器。不想重启就添加回配置,然后把值改为0,再执行sysctl -p

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/184270?site
推荐阅读
相关标签
  

闽ICP备14008679号