I
I
Ilya Plotnikov2015-10-05 15:00:28
iptables
Ilya Plotnikov, 2015-10-05 15:00:28

Why is iptables not broadcasting the real IP?

Installed gateway on iptables. I forward port 10003 from external interfaces to local IP. All packets come from the local ip gateway, and external ones are not visible. Google shows the same configs as mine. Tell me how to broadcast the external ip of the client when forwarding the port?

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]

-A INPUT -i eth1 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p gre -j ACCEPT
-A INPUT -p tcp -m multiport --ports 22 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

COMMIT

*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]

-A PREROUTING -p tcp -m tcp --dport 10003 -j DNAT --to-destination 192.168.100.237:10003

-A POSTROUTING -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o eth1 -j MASQUERADE

COMMIT

*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-10-05
@ilyaplot

-A POSTROUTING -j MASQUERADE

this is ruining everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question