3

I know that ip netns add xxx command can be used to create a linux network namespace, but it is not permanent, meaning after server reboot the created namespace will be gone.

Then how can I create a permanent one which can survive server reboot?

Zii
  • 31
  • 1
  • 3
  • What is the distribution? On debian and derivatives you could just add this to `/etc/network/interfaces` or even use `if-up.d`. – iMil Aug 08 '16 at 06:37

1 Answers1

5

Network namespaces are not persistent across system restarts. You will need to create a script that is run at startup and arrange to have it run.

How you cause it to run depends on your needs, you may be able to cal it from /etc/rc.local or you may be able to hook it into some other script. You may find that you need to hook it into the init system (init scripts/systemd etc) for your (unnamed) OS/Distro.

user9517
  • 114,104
  • 20
  • 206
  • 289