Score:0

iptables nat localhost forwarding

cn flag

Hopefully someone can help here as I've been trawling through different answers and I cant get anything to work.

I have 2 machines - machine 10.3.0.4 current iptables is set up as below:

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-N MY_tcp
-A OUTPUT -o lo -p tcp -j MY_tcp
-A MY_tcp -p tcp -m iprange --dst-range 127.1.1.1-127.1.1.20 -j REDIRECT --to-ports 12000

This works perfectly on this machine and I would like to know if it is possible to forward to my machine on 10.3.0.6?

I have tried the below suggestions:

Enable localhost routing

sysctl -w net.ipv4.conf.all.route_localnet=1
iptables -t nat -A OUTPUT -m addrtype --src-type LOCAL --dst-type LOCAL -p tcp --dport 8888 -j DNAT --to-destination 10.3.0.6
iptables -t nat -A POSTROUTING -m addrtype --src-type LOCAL --dst-type UNICAST -j MASQUERADE

Forward all tcp from 10.3.0.4 > 10.3.0.6

iptables -t nat -A PREROUTING -p tcp --destination 10.3.0.4 -j DNAT --to-destination 10.3.0.6
iptables -t nat -A POSTROUTING -p tcp --destination 10.3.0.6 -j SNAT --to-source 10.3.0.4
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.