S
S
someday82016-10-24 18:22:11
linux
someday8, 2016-10-24 18:22:11

How to redirect traffic to an already busy port?

Good afternoon!
There are 2 centos vps servers, you need to migrate jira from one server to another.
On server number 1 (let's say with ip 1.1.1.1) jira is currently running on port 8080.
On server number 2 (let's say with ip 2.2.2.2) a similar jira is installed and running on port 8081.
!But on server #2, port 8080 is already used by the tomket and cannot be changed!
Question:
During the change of DNS and migration of other servers, it is necessary to redirect incoming traffic from 1.1.1.1:8080 to 2.2.2.2:8081. It is also necessary that port 8080 remains in the browser.
Guys, tell me where to quickly dig out information, examples, there is simply no time to disassemble huge manuals.
ps: I got acquainted with unix systems quite recently, and netfilter is generally a dark forest. So please don't offend

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
someday8, 2016-10-28
@someday8

In general, I solved the problem, who cares:
On the old server:
-------------------------------------- -------------------------------------------------- ------------
*nat
-A PREROUTING -d 1.1.1.1 -p tcp --dport 8080 -j DNAT --to-destination 2.2.2.2:8080
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
*filter
-A INPUT -p tcp --dport 8080 -j ACCEPT
COMMIT
-------------------------------- -------------------------------------------------- ------------------
On the new server:
---------------------------- -------------------------------------------------- ----------------------
*nat
-A PREROUTING -p tcp -d 2.2.2.2 --dport 8080 -j REDIRECT --to-port 8081
COMMIT
*filter
-A INPUT -p tcp --dport 8081 -j ACCEPT
COMMIT
--------------------------------- -------------------------------------------------- ------------------
Everything was easy and simple.

A
Alexander Aksentiev, 2016-10-24
@Sanasol

so that port 8080 remains in the browser.

the port is busy , how do you want to use it if it is busy?
If only to proxy requests from the first server to the second through nginx. Well then and IP will not change actually. In general, nothing will change for the user.
Only sense to spend time for the sake of that the port did not change... In emptiness working time.

M
Maxim, 2016-10-24
@pudovMaxim

I know that you can redirect using nginx, I use proxy_pass 2.2.2.2:8081

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question