Redirect requests to my external IP/port to a different external IP/port?

Prix

Is it possible to redirect connections to a specific IP/port to an external IP/port?

Example:

  • Server A has the external IP xxx.xxx.xxx.xxx
  • Server B has the external IP yyy.yyy.yyy.yyy
  • User sends a request to server A on port 2106, I want to redirect it to server B at port 2106.
Prix

Problem solved:

sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport port -j DNAT --to-destination ip:port
iptables -t nat -A POSTROUTING -j MASQUERADE

Where ip and port are the target server I want to redirect the current server port to.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to redirect external requests?

How to redirect outbound requests to external resource to localhost with different ports?

How can I use the internal macOS firewall to redirect localhost requests from to an external device on my nework?

GitHub: External link to my pull requests

Can i do a general redirect to all the requests to an external website

redirect all external requests to the prod equivalent of the server url .htaccess

How to use <form> and different options with <select> element to redirect to an external website

Get referer URL from external redirect to my application

Redirect an external IP to localhost?

Symfony redirect to external URL

Redirect external URL Angular

How to redirect to an external URL

Redirect to external URL

NodeJS, Express and routing with external requests

Isomorphic fetch not working for external requests?

HMVC internal/external requests and routes?

Mock external http requests in grails

Redirect to external URL in GAE PHP

Elm lang redirect to external URL

Testing redirect links to external sites

Temporary page redirect for external links

Redirect to external URL with return in laravel

External web font via redirect

Redirect to external site in Angular 5

How to redirect to an external domain in Flask?

Redirect from localhost to external url

How to redirect traffic hosted on an azure endpoint (DNS/static IP) to different external IP address

I need my Discord Bot handling GET and POST requests for an external website

SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists - How to bound certificate to ipport?