S
S
sotoros2018-07-22 13:43:11
linux
sotoros, 2018-07-22 13:43:11

How to redirect traffic from one interface to another?

Hello. Faced the following problem.
There is nginx on the machine, the site is hosted on it.
On the local grid, I can access my site on ip - 172.16.8.170 from ip - 172.16.8.191 (another machine on the LAN).
But from the outside world I can’t by ip - 217.149.177.16.

$ ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.8.170  netmask 255.255.0.0  broadcast 172.16.255.255
        inet6 fe80::c288:74b0:fad4:d907  prefixlen 64  scopeid 0x20<link>
        ether 44:8a:5b:8e:c7:35  txqueuelen 1000  (Ethernet)
        RX packets 15304850  bytes 19034375292 (19.0 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9759984  bytes 924136878 (924.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Локальная петля (Loopback))
        RX packets 121893  bytes 16842812 (16.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 121893  bytes 16842812 (16.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1400
        inet 217.149.177.16  netmask 255.255.255.255  destination 10.111.111.1
        ppp  txqueuelen 3  (Протокол PPP (Point-to-Point Protocol))
        RX packets 13931448  bytes 18720267169 (18.7 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8841915  bytes 602120766 (602.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I have been looking for an answer to this question on the Internet for 4 days. Basically they write that everything is solved through iptables, but no matter what manipulations I did, it refuses to work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sotoros, 2018-07-30
@sotoros

In general, the problem was that the provider can block "standard" ports (such as 22, 80 ... ). As a result, the solution to the problem was to change the "standard" port.

V
Vladimir Skibin, 2018-07-22
@megafax

If you have a white IP, then add to the nginx listen config with the desired IP:PORT and that's it, no redirects are needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question