LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   iptables redirect (https://www.linuxquestions.org/questions/linux-networking-3/iptables-redirect-6868/)

bhartnett 09-25-2001 07:48 AM

iptables redirect
 
I'm having problems getting iptables to redirect from my firewall to my web server. I have two NIC cards. eth0 for the internet and eth1 for my LAN. my kernel is 2.4.9 and I have all of the netfiltering options for IPv4 and IPv6 built into it.

I have tried these rules in all sorts of combos.

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -d 192.168.0.2 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-destination 192.168.0.2:80

#iptables -A FORWARD -s 192.168.0.0/24 -d 192.168.0.1 -i eth1 -o eth0 -p tcp --dport 80 -j ACCEPT
#iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-destination 192.168.0.2
#iptables -t nat -A PREROUTING -i eth0 -s 0.0.0.0/0 -p tcp --dport 80 -j REDIRECT --to-destination 192.168.0.2

When I connect to it from the internet it I have a long wait for the first connection (I generally reconnect) and then it gives me a "The page cannot be displayed message". When I connect to the server from my LAN I get the web page. I would appreciate any input on this.

Thanks,

Brett Hartnett

DavidPhillips 09-26-2001 09:11 PM

I have this line

iptables -A tcp_packets -p TCP -s 0/0 --dport 80 -j allowed

and this one

iptables -A INPUT -p TCP -i eth0 -j tcp_packets


hope it helps


All times are GMT -5. The time now is 01:29 AM.