4

To run tests on the development build of my program I need to isolate it from the network. The build still needs access to loopback (127.0.0.1) though.

I tried using unshare -c -n <program> but the loopback interface is down by default. Using unshare -r -n bash allows me to enable the interface by using ip link set lo up but the program needs to be invoked manually in that bash shell then.

I tried to create a persistent network namespace (ip netns add vnet1) but that only works with sudo which I need to avoid.

So it is possible to create a unshared network namespace with lo down, without using sudo.

I need to get the lo interface up before launching the build. Ideally I'd integrate the the setup in a bash script without using privilege escalation. I've read that fedora provides a enabled loopback interface by default, so can I adjust this behavior with sysctl etc. ? (I'm on archlinux)

Kitsune
  • 117
  • 5

0 Answers0