Let suppose we have two network namespaces that belong to the same subnet. In this context I mean same IP address but different routes it needs to take to get to.
ip netns add myns1
ip netns add myns2
And Java program is running in Linux global namespace, and from Java, how do I connect using Linux name space?
Socket s = new Socket(ip, port);
// the following allows to pass which name space to select...
Socket nameSpace Socket = new SocketWithNameSpace(ip,port,namespace);
Is there any API to pass Linux namespace or is there any native existing library that achieve this and I can call from Java?
Update:
There is Netlink Protocol Library Suite ( http://www.infradead.org/~tgr/libnl/) which is used within C program to switch namespace. Does anyone know if there is any Java API using this library exist for switching between Linux name space.
Any pointer or help or more info is greatly appreciated !
Tanks,
Bhavesh