LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-04-2009, 10:37 AM   #1
emjga
LQ Newbie
 
Registered: Jul 2008
Posts: 4

Rep: Reputation: 0
Forward Port 80 from eth0 to eth1


Folks

I have the following setup.
Linux Workstation with 2 NIC RHWS 4.7

eth0 10.49.7.14 (Normal Vlan)
eth1 192.162.1.2 (Private Vlan)

On the Private Vlan is a Tape drive with its own Web interface
IP address 192.162.1.1

I would like to allow any one to point there web browser at 10.49.7.14
but get re-directed to the Tape Web interface.

I have tried the following but did not seem to work.
Code:
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j DNAT --to 192.162.1.2:80
iptables -A FORWARD -p tcp --dport 80 -d 192.162.1.2 -j ACCEPT
iptables -A FORWARD -p tcp --sport 80 -d 192.162.1.2 -j ACCEPT
iptables -nvL Shows the following
Code:
Chain INPUT (policy ACCEPT 2998 packets, 413K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 7 packets, 420 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.162.1.2         tcp dpt:80
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.162.1.2         tcp spt:80

Chain OUTPUT (policy ACCEPT 1055 packets, 104K bytes)
 pkts bytes target     prot opt in     out     source               destination
iptables -t nat -nvL Shows the following
Code:
Chain PREROUTING (policy ACCEPT 2113 packets, 259K bytes)
 pkts bytes target     prot opt in     out     source               destination
   14   840 DNAT       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 to:192.162.1.2
    0     0 DNAT       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 to:192.162.1.2:80
    0     0 DNAT       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 to:192.162.1.2:80

Chain POSTROUTING (policy ACCEPT 216 packets, 20556 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 210 packets, 20196 bytes)
 pkts bytes target     prot opt in     out     source               destination
Can any body help and suggest where I have gone wrong.

Thanks

Matt
 
Old 02-04-2009, 11:57 AM   #2
richardash1981
LQ Newbie
 
Registered: Aug 2006
Posts: 25
Blog Entries: 1

Rep: Reputation: 18
You don't want to redirect responses back to the clients, so your last line is wrong, take out
Code:
iptables -A FORWARD -p tcp --sport 80 -d 192.162.1.2 -j ACCEPT
This first two seem to match other guides on the net.
 
  


Reply



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
forwarding a specific port from eth0 to eth1 zovres Linux - Networking 2 05-02-2006 10:01 PM
x86 board PCM 6892 with dual ethernet port.eth1 doesnt ping if eth0 cable removed rani_162 Linux - Newbie 0 07-23-2005 12:29 PM
port forwarding from eth0 to eth1 ? overproof Linux - Networking 7 05-16-2005 02:48 AM
port forward from eth0 to eth1 ryanzietlow Linux - Networking 8 03-01-2005 10:08 AM
eth1 added, mysql connections FROM this machine are from eth1. Need bound to eth0??? kreese Linux - Networking 9 03-31-2004 12:12 PM

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

All times are GMT -5. The time now is 02:36 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