Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
prerouting DNAT
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
syn0ptik
Apprentice
Apprentice


Joined: 09 Jan 2013
Posts: 265

PostPosted: Thu Dec 04, 2014 11:36 am    Post subject: prerouting DNAT Reply with quote

Hello,
Could someone suggest me something?
I have only rules I show here.
All chains accepts packets.
eth0 - external interface
br0 - internal interface.
Code:
#works
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.0.130 -s 192.168.101.0/24

#not works
iptables -A FORWARD -i eth0 -d 192.168.101.11 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.155 -j DNAT --to-destination 192.168.101.11
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.130 --dport 5900 -j DNAT --to-destination 192.168.101.11:5900

also I made
Code:

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 >/proc/sys/net/ipv4/conf/all/forwarding
Back to top
View user's profile Send private message
hololeap
n00b
n00b


Joined: 05 Oct 2013
Posts: 29

PostPosted: Fri Dec 05, 2014 10:11 am    Post subject: Reply with quote

Quote:
iptables -A FORWARD -i eth0 -d 192.168.101.11 -j ACCEPT


If you have all filter chains on a default ACCEPT policy, then this shouldn't be necessary.

Quote:
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.155 -j DNAT --to-destination 192.168.101.11
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.130 --dport 5900 -j DNAT --to-destination 192.168.101.11:5900


I'm confused by this. You have two different rules that match two different destination IP addresses. Do you have multiple IPs configured on the same interface?

I think that you will get more help if you give more information, such as IP addresses and what interfaces they are on, as well as your basic goals (where are you redirecting the packets to and why?)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum