{"id":4839,"date":"2023-02-24T01:39:00","date_gmt":"2023-02-24T07:39:00","guid":{"rendered":"https:\/\/www.incredigeek.com\/home\/?p=4839"},"modified":"2023-02-24T01:30:18","modified_gmt":"2023-02-24T07:30:18","slug":"librenms-could-not-ping-192-168-1-20-192-168-1-20","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/librenms-could-not-ping-192-168-1-20-192-168-1-20\/","title":{"rendered":"LibreNMS &#8211; Could not ping 192.168.1.20 (192.168.1.20)"},"content":{"rendered":"\n<p>LibreNMS uses fping to check if devices are up or not.  So if something is broken with fping, say a SELinux permission, you can receive the &#8220;Could not ping&#8221; error, while trying to add a new device.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2023\/02\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2023\/02\/image-4.png\" alt=\"\" class=\"wp-image-4840\" width=\"514\" height=\"234\" srcset=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2023\/02\/image-4.png 510w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2023\/02\/image-4-300x136.png 300w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2023\/02\/image-4-500x227.png 500w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/a><figcaption class=\"wp-element-caption\">LibreNMS unable to ping device<\/figcaption><\/figure>\n\n\n\n<p>First we need to verify that fping is working.  SSH into the LibreNMS server and try pinging an address.  <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">fping 192.168.1.20<\/pre>\n\n\n\n<p><em>There was an issue with fping working if ipv6 was disabled.  If fping is not working at all, check out this <a href=\"https:\/\/community.librenms.org\/t\/could-not-ping-host-error\/6981\/5\">thread<\/a>.<\/em><\/p>\n\n\n\n<p>If you get an alive or unreachable message, then we know fping is working and can move on to the next stage of troubleshooting.<\/p>\n\n\n\n<p>If you are using SELinux, then there is a good chance the problems has to do with that.  You can try rerunning all the SELinux commands from the install guide.  Note that it has a specific portion for fping.<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.librenms.org\/Installation\/Install-LibreNMS\/#selinux\">https:\/\/docs.librenms.org\/Installation\/Install-LibreNMS\/#selinux<\/a><\/p>\n\n\n\n<p>If it is still not working, we can take a look at the issue with the audit2why command and feed in the audit log.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">audit2why &lt; \/var\/log\/audit\/audit.log<\/pre>\n\n\n\n<p>Here is some example output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@librenms ~]#\ntype=AVC msg=audit(1676192040.183:404404): avc:  denied  { bind } for  pid=128555 comm=\"fping\" lport=1 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=rawip_socket permissive=0\n\n        Was caused by:\n                Missing type enforcement (TE) allow rule.\n\n[root@librenms ~]#<\/pre>\n\n\n\n<p>Another, perhaps more effective way to check the log is to follow it using the &#8220;tail -f&#8221; command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tail -f \/var\/log\/audit\/audit.log | grep denied<\/pre>\n\n\n\n<p>And then in the web browser, try adding a new device.  If SELinux is blocking it, it should throw a denied entry.  <\/p>\n\n\n\n<p>Example output<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">type=AVC msg=audit(1676192040.183:404404): avc:  denied  { bind } for  pid=128555 comm=\"fping\" lport=1 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=rawip_socket permissive=0<\/pre>\n\n\n\n<p>Now we have verified that the issue is SELinux permissions related.  We can create a module to allow it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">audit2allow -a -M fping_http &lt; \/var\/log\/audit\/audit.log<\/pre>\n\n\n\n<p>And apply the module with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">semodule -i fping_http.pp<\/pre>\n\n\n\n<p>You may need to do this a couple times.  Check the audit log again to see if anything new shows up.  Notice the slight difference in this error compared to the above error.<\/p>\n\n\n\n<pre id=\"block-8ff8f3df-bd85-4904-a432-51eb86e54a0f\" class=\"wp-block-preformatted\"># tail -f \/var\/log\/audit\/audit.log | grep denied\ntype=AVC msg=audit(1676192613.121:404409): avc: denied { node_bind } for pid=153257 comm=\"fping\" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:<strong>object_r:node_t<\/strong>:s0 tclass=rawip_socket permissive=0<\/pre>\n\n\n\n<p>We&#8217;ll create a new module for this and apply it<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">audit2allow -a -M node_http &lt; \/var\/log\/audit\/audit.log\nsemodule -i node_http.pp<\/pre>\n\n\n\n<p>Not sure that is the best way to fix the problem.  But it appears that SELinux is keeping Apache &#8220;httpd&#8221; from running fping which is why we need to create and load the modules.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LibreNMS uses fping to check if devices are up or not. So if something is broken with fping, say a SELinux permission, you can receive the &#8220;Could not ping&#8221; error, while trying to add a new device. First we need &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/librenms-could-not-ping-192-168-1-20-192-168-1-20\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[352],"tags":[353,235,207],"class_list":["post-4839","post","type-post","status-publish","format-standard","hentry","category-librenms","tag-librenms","tag-logs","tag-selinux"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=4839"}],"version-history":[{"count":4,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4839\/revisions"}],"predecessor-version":[{"id":4844,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4839\/revisions\/4844"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=4839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=4839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=4839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}