Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

many ip addresses on machine, set outgoing ip java

I recently got a machine with 10 IPv6 addresses, this is a CentOS running MySQL and tomcat, I'm using spring to create servlets.

I was wondering is there a Java way (not OS routing tables) to set the outgoing IP from the ones available on my server?

What I am trying to do is have a incoming address reach the servlets and do an http post from a specific IP accordingly.

For all my research the thing I saw closest to solving this would be httplib, but is there something like this for Java?

like image 744
twk87 Avatar asked Jun 21 '26 22:06

twk87


1 Answers

just use localaddr parameter in your socket.

Pretty much duplicate question here:

like image 168
Mark Avatar answered Jun 24 '26 12:06

Mark