K
K
Kirill Kazakov2015-07-06 04:18:54
Computer networks
Kirill Kazakov, 2015-07-06 04:18:54

Is it possible to pass guest ip to local machine?

OS Debian 8, pure-ftpd - server, all vps - openvz containers.
There is an ftp server on vps2 with a local ip , there is a vps1 with a real ip where traffic is redirected (using iptables) to the desired local ip.
When connecting to an ftp server (with local ip), only external ip information (with vps1 ) is written in the logs, but information about the client's ip (not vps1 itself ) is needed.
Is it possible to somehow pass the client's ip to the vps2 logs ?
UPD1: I am
redirecting now according to this rule:

iptables -t nat -A PREROUTING --dst %YOU_PUBLIC_ADDRESS% -p tcp -m multiport --dport 21,50000:51000 -j DNAT --to-destination 192.168.10.10
iptables -t nat -A POSTROUTING --dst 192.168.10.10 -p tcp -m multiport --dport 21,50000:51000 -j SNAT --to-source %YOU_PUBLIC_ADDRESS%

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I FORWARD 1 -i venet0 -o venet0 -d 192.168.10.10 -p tcp -m multiport --dport 21,50000:51000 -j ACCEPT

The logs show %YOU_PUBLIC_ADDRESS% , not the client's address.
UPD2:
Perhaps it is worth describing the network in more detail.
There is a PVE (Proxmox based on debian) - it has a physical eth0 and a white ip. On it the bridge is raised.
There is vps1 - it has a connection through a host, it has a white ip, a venet interface.
There is vps2 - it has a connection through the host, has a local ip, is connected to the bridge, has access to the Internet.
On vps1 , nginx is up, which listens on everything on port 80;443 and redirects to vps2 if there is a corresponding vhosts entry.
There was a task - to give access via ftp to vps2 , where instead of ip is the domain name.
Now this scheme works, but as mentioned above, the ip address is determined by vps1 .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-07-06
@edinorog

I don’t know how port forwarding works for you there, but with normal settings, the internal server sees the IPs from the outside

C
Cool Admin, 2015-07-06
@ifaustrue

With classic nat translation, this information cannot be transmitted (in the same way, your local address cannot be transmitted outside with src nat - this is the meaning and essence of the technology).
In other protocols (for example, http and its proxy), a protocol extension is used for this purpose.
But of course you need to look at what kind of software you have there, there are types of NAT that allow you to pass addresses of public hosts through yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question