I'm looking if it's possible to give rights, to only allow the use of one network interface to a specific user on a Linux distribution.

My use case: I want, for my studies, testing the interconnection between about 30 servers, all listening on the same port. For now, I can only launch 7-8 VM and on them my server scripts due to physical material limitations. Even if I'm using a low resource consumption Linux distribution (like SliTaz). The scripts are requiring that I have multiple interfaces because they listening all on the same port.

What I think it can be possible to do, is duplicate an Ethernet interface on a single VM (30 times), create 30 different users, set for each user a different Ethernet interface and launch my server script on each user. Script will listen on each interface available, either a single interface available per user. My script is about 5Mo in RAM, so I don't have to launch 30*128Mo of VM and I can more easily create users, than duplicate VM, set MAC address and IPs on each VM.

I did see that it's possible to create multiple interfaces. How can I set rights on anetwork interface for a specific user? Or is there a better solution for this problem?

  • That exactly what I was looking for. I'm impatient to try this, Thank you Marius. Thank you Anthon too. – Kantium Oct 29 '13 at 17:22

You should consider the possibility of using less resource-intensive virtualization options. The one I have in mind for your problem is the "network namespace", for which you find a simple yet sufficient introduction here.

With this minimalistic virtualization scheme, you endow each shell with exactly one (virtual!) NIC, no more no less. The overhead is the creation of a new shell per user, and you maintain the availability of all of your programs. You can then start different instances of the same program listening on the same port, of different interfaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.