Access a local server from the firewall's public IP
Hello all,
I'm configuring a DNS firewall and I got stuck in the following situation: one of my teammates must access a local server (192.168.1.2:10100) but he must do it using the firewall's public IP (say, 200.221.1.21). I ran ping over those IPs and all seems to be working fine.
I tried the following code in nat's PREROUTING chain:
Code:
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -o $INET_IFACE -d $INET_IP --dport 10100 -j DNAT --to-destination 192.168.1.2
In the POSTROUTING:
Code:
$IPTABLES -t nat -A POSTROUTING -p TCP -o $LAN_IFACE --dport 10100 -j SNAT --to-source LAN_IP
$IPTABLES = /usr/sbin/iptables
LAN_IFACE = eth1
INET_IFACE = eth0
INET_IP = Firewall's public IP
LAN_IP = 192.168.1.1 (Firewall's private IP)
Also, I tried adding the port to the server's host, like 192.168.1.2:10100 or --sport 10100 (in the POSTROUTING) but that didn't work either
I'm not a linux hacker but a hard worker and I'm really trying my best to find a solution to this (searching google for about 6~7 hours now)
Anyway, thanks in advance :)