# issue for enabling/disabling ping with sysctl

**URL:** <https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704>\
**Category:** Ansible Project\
**Created:** [March 5, 2014, 8:56am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704 "2014-03-05T08:56:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [March 5, 2014, 8:56am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/1 "2014-03-05T08:56:37Z")

</div>

Hello all,

I want to use sysctl module to enable / disable ping.  
When I wrote a action as **"sysctl: name=net.ipv4.icmp\_echo\_ignore\_all value=0 reload=yes state=present**", indeed it cannot enable ping. I don’t know why?  
The command is wrong?

Best regards,  
Guo Yan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 5, 2014, 12:55pm UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/2 "2014-03-05T12:55:37Z")

</div>

When you said you cannot enable ping, what behavior did you witness?

Also what version of Ansible are you using and what platform are you running the command on?

Thanks!

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [March 6, 2014, 3:10am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/3 "2014-03-06T03:10:15Z")

</div>

1. Make the remote host ping disable: **[root@devhost ~]# sysctl -w net.ipv4.icmp\_echo\_ignore\_all=1**

2. Run playbook task action: **sysctl: name=net.ipv4.icmp\_echo\_ignore\_all value=0 reload=yes state=present**

3. Try to ping the remote host: It is still failed. **( I expect the remote host ping enable)**

**[test@test test]$ ping 192.168.126.155PING 192.168.126.155 (192.168.126.155) 56(84) bytes of data.**  
**^C**  
**— 192.168.126.155 ping statistics —**  
**5 packets transmitted, 0 received, 100% packet loss, time 4430ms**

My ansible version is:

**[test@test test]$ ansible --version**  
**ansible 1.5 (devel 27199dc219) last updated 2013/12/03 21:01:10 (GMT -500)**

---

<div class="post-metadata">

**Author:** ![Walid](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@Walid](https://forum.ansible.com/u/Walid)\
**Post date:** [March 6, 2014, 3:36am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/4 "2014-03-06T03:36:44Z")

</div>

did you check on the host the state of the sysctl parameter before and after the ansible run?

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [March 6, 2014, 4:35am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/5 "2014-03-06T04:35:02Z")

</div>

Firewalls and various other factors aside, please verify 2 things:

1. the line exists in sysctl.conf after running the module
2. the property is set when you run “sysctl net.ipv4.icmp\_echo\_ignore\_all”

If those two items are true, the module is working as expected.

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [March 6, 2014, 5:57am UTC](https://forum.ansible.com/t/issue-for-enabling-disabling-ping-with-sysctl/14704/6 "2014-03-06T05:57:55Z")

</div>

It is very strange. I do two cases:

**Case 1:**

1. Use command “ **sysctl -w net.ipv4.icmp\_echo\_ignore\_all=1** ” to disable ping
2. Use **playbook sysctl module** to enable ping, enabling ping would be **failed**.

**Command sysctl -w net.ipv4.icmp\_echo\_ignore\_all=1 doesn’t change /etc/sysctl.conf file. In this case, sysctl module also doesn’t change /etc/sysctl.conf.**

**Case 2:**

1. Update **/etc/sysctl.conf** to set **net.ipv4.icmp\_echo\_ignore\_all=1**  
**2.** Execute **sysctl -p** to disable ping
2. Use **playbook sysctl module** to enable ping, enabling ping would **be succesful**.

**In this case, sysctl module changes /etc/sysctl.conf.**
