LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2001, 08:48 AM   #1
bhartnett
LQ Newbie
 
Registered: Sep 2001
Posts: 1

Rep: Reputation: 0
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
 
Old 09-26-2001, 10:11 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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

Last edited by DavidPhillips; 09-26-2001 at 10:14 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Some sort of redirect with iptables? zooper Linux - Networking 2 09-22-2005 03:11 AM
iptables redirect patvrs Linux - Networking 15 08-02-2005 09:31 AM
iptables redirect _ben_deb_ Linux - Networking 7 11-13-2004 06:06 AM
IPTABLES redirect question yuzuohong Linux - Networking 3 01-01-2003 10:30 PM
iptables redirect slack Linux - Networking 0 06-17-2002 05:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration