A
A
Andrey Minisol2016-08-05 17:18:01
linux
Andrey Minisol, 2016-08-05 17:18:01

How to correctly wrap a request to a local address?

Good afternoon.
Could you please tell me how you can locally wrap the request to yourself
The bottom line is, there is a server, it has an external address, suppose this: 233.233.233.233 its
local address is this: 192.168.0.1
how can I make a request sent from php to the address 233.233.233.233 was wrapped to localhost or to 192.168.0.1

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Puma Thailand, 2016-08-05
@opium

send it directly from php to localhost

A
Alexander, 2016-08-05
Madzhugin @Suntechnic

Well, in theory, here it is:

-t nat -A PREROUTING -d 233.233.233.233  -j DNAT --to-destination 192.168.0.1
-t nat -A POSTROUTING -s 192.168.0.1  -j SNAT --to-source 233.233.233.233

But in practice, I do not plow. Why am I wrong?

E
efkot, 2016-08-05
@efkot

Give host A a dns record with an address from the network 192.168.0.0/24 and make all requests for the name.

S
Sergey, 2016-08-05
@Celebro

iptables -t nat -A OUTPUT -d 233.233.233.233 -j DNAT --to-destination 127.0.0.1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question