snipt

Ctrl+h for KB shortcuts

Bash

Disable ping reply on GNU/Linux

1
2
3
4
5
# Disable ping reply temporarily
echo "1" >  /proc/sys/net/ipv4/icmp_echo_ignore_all

# Enable the ping reply back
echo "1" >  /proc/sys/net/ipv4/icmp_echo_ignore_all
https://snippets.siftie.com/embed/5063d2b6586f01564ef8b213ac66fa30/
/raw/5063d2b6586f01564ef8b213ac66fa30/
5063d2b6586f01564ef8b213ac66fa30
bash
Bash
5
2019-02-18T12:08:46
True
False
False
/api/public/snipt/16453/
disable-ping-reply
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Disable ping reply temporarily</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">echo</span> <span class="s2">&quot;1&quot;</span> &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Enable the ping reply back</span> </span><span id="L-5"><a name="L-5"></a><span class="nb">echo</span> <span class="s2">&quot;1&quot;</span> &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all </span></pre></div> </td></tr></table>
bash, echo, linux, ping, reply