Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • This seems to work, thanks. Is it possible to also forcibly close the existing sockets that the processes blocked using this method have open? Commented Jul 20, 2022 at 3:45
  • that could be done using lsof and ss -K, but seems a bit complex Commented Jul 20, 2022 at 3:55
  • Interestingly, on one of my machines, the method in this answer worked, but on another one of my machines I had to create the cgroup in /sys/fs/cgroup/net_cls/disable-network instead and identify the cgroup by ID as described here. I don't fully understand why the method in this answer works on one machine and the one in that answer works on another. Commented Jul 20, 2022 at 19:01
  • no mystery, the linked answer uses cgroups version 1, my answer uses cgroups version 2; of course the latter is more recent and they are mutually exclusive Commented Jul 20, 2022 at 19:19