Im looking for a way to have applications started from different accounts automatically bind to a specific network interface. For example: applications started on accountA bind to eth0 and applications started from accountB bind to eth1. Is there any way I can accomplish this? I hope this is easier to understand. I would like to do this because im looking to share a dedicated server with someone. It would be beneficial if we could have account specific ip's so we could both run services requiring the same port without the hassle of trying to bind every application.
migrated from superuser.com Dec 2 '11 at 20:50
This question came from our site for computer enthusiasts and power users.
First you have to configure all interfaces with their own routing tables (look at /etc/iproute2/rt_tables). Then you need to mark traffic based on UID. Use ipt_owner module for that. Then add routing rules for these marks (fwmark). This is good start for such exercise: Linux Advanced Routing & Traffic Control HOWTO