Re: Obtain original address from redirected connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Sorry for the late answer, I just subscribed to the list]

Hello,

Pedro Werneck wrote :

I have a daemon, a sort of proxy, written in Python, who receives
redirected connections with a rule like this:

iptables -t nat -A PREROUTING -j DNAT -p TCP -s source --to-destination host:port

The problem is that I need access to the original destination address,

You can parse /proc/net/ip_conntrack on the NAT box, which contains the list of the connections currently handled by conntrack/NAT. This is how Squid retrieves the original destination address when running in transparent mode.
Note : on "recent" kernels you need root privileges to read this file.


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux