Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping do not work in lxc containers #247

Open
Apollon77 opened this issue Oct 9, 2022 · 1 comment
Open

ping do not work in lxc containers #247

Apollon77 opened this issue Oct 9, 2022 · 1 comment
Labels

Comments

@Apollon77
Copy link
Collaborator

  • see subject ... all IPS are returned as offline and so only localhost is checked
  • docker has other issues too
@Apollon77 Apollon77 added the bug label Oct 9, 2022
@Jey-Cee
Copy link
Contributor

Jey-Cee commented Feb 2, 2024

Found out that this seems to be a bug in proxmox for long time now. -> https://forum.proxmox.com/threads/ping-with-unprivileged-user-in-lxc-container-linux-capabilities.42308/
The problem is that the rights are not correct set for ping.

I have written a simple script to check if the rights are correct and if not they will be set. I am not sure where is the best place to add this function, while the same bug possible effect other adapter when they want to use ping.
We should also remember that a system update can change the rights again, as someone has written on the forum thread.

`const os = require('os');
const { exec } = require('child_process');

if (os.type() === 'Linux') {
exec('setcap -v cap_net_raw+p /bin/ping', (error, stdout, stderr) => {

if (stdout) {
  if (stdout.includes('differs in [p]')) {
    exec('sudo setcap cap_net_raw+p /bin/ping', (error, stdout, stderr) => {
      if (stderr) {
        console.error(`Error setting permissions: ${error}`);
      } else {
        console.log('Permission set for pinging.');
      }
    });
  }
}

});
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants