Exercise 24.1: System Tunables with sysctl
Hi,
Somehow I cannot deactivate the ping on my computer...
┌──(alu@nb)-[~] └─$ sudo sysctl net.ipv4.icmp_echo_ignore_all=1 net.ipv4.icmp_echo_ignore_all = 1 ┌──(alu@nb)-[~] └─$ ping -c 3 localhost PING localhost(localhost (::1)) 56 data bytes 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.013 ms 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.055 ms 64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.041 ms --- localhost ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2048ms rtt min/avg/max/mdev = 0.013/0.036/0.055/0.017 ms
What could be the reason?
Thanks,
Urs
Answers
-
Hi Urs,
I just tried it on Ubuntu 24.04 and worked for me.
1.- What OS and version are you testing with?
2.- What's the kernel version?uname -r
Regards,
Luis.0 -
Hi Luis,
Thanks for your reply.
I'm on Debian:
┌──(alu@nb)-[~] └─$ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" ┌──(alu@nb)-[~] └─$ uname -r 6.1.0-25-amd64
Regards,
Urs0 -
Hi Urs,
Unfortunately I was able to reproduce the issue on Debian 12 and kernel version 6.1.0-26-amd64.
So, if I do "cat /proc/sys/net/ipv4/icmp_echo_ignore_all" it gives "1", which should deactivate ping localhost, but it isn't. Also, I got net.ipv4.icmp_echo_ignore_all=1 to /etc/sysctl.conf, restarted the associated service with "service procps force-reload", and it didn't work. That's bad, because that means that /etc/sysctl.conf is not working as expected. I also restarted the system and it didn't work either.Before all of that I stopped the default firewall, just in case.
You can check the Debian documentation about this item here:
https://www.debian.org/doc/manuals/securing-debian-manual/network-secure.en.html
So, at this point it looks to me as a bug. I recommend to try with any other distro. It worked for me with Ubuntu.
Regards,
Luis.0 -
Hi Urs,
On Debian you also need to do the following (block icmp for ipv6 as well):
echo "1" > /proc/sys/net/ipv6/icmp/echo_ignore_all
After that, pings to localhost will be ignored.
Regards,
Luis.0 -
Hi Luis,
Thank you very much.
Now I got it too. So it seams that, if icmp on ipv4 is disabled, Debian switches to icmp on ipv6 (if possible). In my case, as I use DHCP, apart form the ipv4 address, my computer was assigned an ipv6 address as well. Maybe that's the reason about this behavior.
In case it's not a bug, you may consider to update the according lab in the course.
Best wishes,
Urs0 -
Hi Urs, it's a pleasure!
Now I got it too. So it seams that, if icmp on ipv4 is disabled, Debian switches to icmp on ipv6 (if >possible). In my case, as I use DHCP, apart form the ipv4 address, my computer was assigned an ipv6 >address as well. Maybe that's the reason about this behavior.
Yes, it's a feature, not a bug, hehehe.
Regards,
Luis.0
Categories
- All Categories
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 745 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 73 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 2 LFD103-JP クラス フォーラム
- 4 LFD210-CN Class Forum
- 764 LFD259 Class Forum
- 681 LFS101 Class Forum
- 2 LFS158-JP クラス フォーラム
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 19 LFS256 Class Forum
- 1.4K LFS258 Class Forum
- 165 LFS261 Class Forum
- 26 LFS267 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 105 Mobile Computing
- 18 Android
- 72 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 944 Programming and Development
- 310 Kernel Development
- 616 Software Development
- 977 Software
- 369 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)