networking – Add iptables programmatically using Java for port forwarding


Is there a method (using the java.net package or a protocol) that could be used by a Java-based client application in the intranet to map the port to the residential gateway iptable ( router) to allow access from the Internet? I noticed that a chat application could automatically add a range of ports to the router for port forwarding. I don't know if a pure Java application could do this or not. Or should you use libiptc + JNI to perform this function?