Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Iptables rule please help
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
reedrichard
n00b
n00b


Joined: 30 Sep 2019
Posts: 2
Location: Singapore

PostPosted: Mon Sep 30, 2019 3:42 pm    Post subject: Iptables rule please help Reply with quote

Hi ,I am try to do use DNAT to port forward my server to other host but my gentoo box is not forwarding. I have other gentoo box in different location but that box is doing fine with DNAT. I even tried to copy .config and rebuild kernel but still no success. Please help..
Here is simple script i have been trying. Port forward to any service hosted on the box itself is working except forward to other host not working.

Code:
iptables -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -X
sysctl -w net.ipv4.ip_forward=1
iptables -t nat --flush

iptables -t nat -A PREROUTING -p tcp --dport 99 -j DNAT --to 192.168.1.100:80 (not working, 1.100 is reachable with 80 in same network)
iptables -t nat -A PREROUTING -p tcp --dport 88 -j DNAT --to 192.168.1.1:22 (working , 192.168.1.1 is the problematic box itself)

[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5908

PostPosted: Mon Sep 30, 2019 11:18 pm    Post subject: Reply with quote

I could be wrong, but those DNAT rules are missing an input interface...
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
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