I have a requirement where my application is supposed to bind to several interfaces and inject packets. The problem is some of these interfaces need not be on the root network namespace. I would like to know if this is possible. If yes please upload a snippet. Preferable languages are python, c. Or at least point me in the correct direction.
Asked
Active
Viewed 825 times
0
-
you want to bind a socket to an interface ? – Vikram Singh Jan 20 '14 at 05:31
-
Not that simple. I do understand that I have to use multiple sockets. In my case ifconfig will not list some of the interfaces that I need to bind to, because they exists in a different namespace. If you are not aware of namespaces check [this](http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fblog.scottlowe.org%2F2013%2F09%2F04%2Fintroducing-linux-network-namespaces%2F&ei=fbjcUtubFIiPrQfu8IHQBQ&usg=AFQjCNFglg0HlCpEynwug7hIcwI3d72b2g&sig2=9bbmkPInmzAgOXO5pQabaw&bvm=bv.59568121,d.bmk) – Akilesh Jan 20 '14 at 05:48
-
I think this is a duplicate of: http://stackoverflow.com/questions/28846059/can-i-open-sockets-in-multiple-network-namespaces-from-my-python-code . Basically you setns(), open/bind the socket, then setns to the next namespace. Already open sockets remain functional. – AnyDev Jul 23 '16 at 12:35