LinuxQuestions.org
Review your favorite Linux distribution.
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 01-01-2003, 08:22 AM   #1
yuzuohong
Member
 
Registered: May 2002
Location: Shanghai, PRC
Distribution: RedHat 6.2 | 7.2 | 8 | 9|3
Posts: 81

Rep: Reputation: 15
Angry IPTABLES redirect question


Hi all,

We've got two RedHat 7.2 servers (A and B) in our LAN. Server A has 2
network cards, one is 202.x.x.1(eth0) and the other is 192.168.x.1(eth1).
Server B has only one network card and the IP address is 192.168.x.2(eth0). Server A does the NAT work for the whole LAN using
iptables POSTROUTING chain, including server B.
We can access server A and even our LAN from outside. Now I want do such
kind of work, through which we can browse the APACHE website on server B.
That means when someone browse http://202.x.x.1:80, server A will forward
this request to server B, that is 192.168.x.2:80. This is the command I
typed on server A: $iptables -t nat -A PREROUTING -i eth0 -p tcp -s 0/0 -d
localhost --dport 80 -j DNAT --to 192.168.x.2:80.
But I'm sure that's a wrong method, since I still see the apache test page
on server A, instead of formal website on server B.
Please give me some advice.
Any help will be appreciated.

zuohong
 
Old 01-01-2003, 11:51 AM   #2
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
try...

$iptables -t nat -A PREROUTING -i eth0 -p tcp -s 0/0 -d
202.x.x.1 --dport 80 -j DNAT --to 192.168.x.2:80
 
Old 01-01-2003, 07:07 PM   #3
yuzuohong
Member
 
Registered: May 2002
Location: Shanghai, PRC
Distribution: RedHat 6.2 | 7.2 | 8 | 9|3
Posts: 81

Original Poster
Rep: Reputation: 15
Hi,

I tried thisway. When I forward the request to a formal IP(like 61.x.x.x), that's ok. But when I tried to forward the request to server B or any other PCs in our LAN, I still just can see the web page on server A.
 
Old 01-01-2003, 09:30 PM   #4
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
try this...

$iptables -A FORWARD -p tcp -s 0/0 -d 192.168.x.0/24
--dport 80 -j ACCEPT
 
  


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
iptables redirect patvrs Linux - Networking 15 08-02-2005 08:31 AM
iptables redirect _ben_deb_ Linux - Networking 7 11-13-2004 05:06 AM
Iptables Redirect Question x86br Linux - Security 1 09-22-2004 08:48 AM
IPTABLES redirect question yuzuohong Linux - General 2 01-01-2003 10:47 AM
iptables redirect bhartnett Linux - Networking 1 09-26-2001 09:11 PM

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

All times are GMT -5. The time now is 04:28 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration