Networking Forums

Networking Forums > Computer Networking > Linux Networking > Natting Problem

Reply
Thread Tools Display Modes

Natting Problem

 
 
Eddie
Guest
Posts: n/a

 
      09-22-2003, 01:38 PM
I have a public facing box that also has a pseudo interface (please
note real ip addresses have not been disclosed)

eg: eth0 192.168.1.200
eth0:1 192.168.1.201

i have also registered a domain against each ip address

eg: www.mydomain1.com forwards to 192.168.1.200:80
www.mydomain2.com forwards to 192.168.1.201:80

i am trying to set up some natting that will internally re-direct to a
different port - based upon the distination address

eg: for traffic hitting 192.168.1.200:80 -> 192.168.1.200:7100
for traffic hitting 192.168.1.201:80 -> 192.168.1.201:7200

here is my script:

#!/bin/sh

/sbin/iptables -A FORWARD -p tcp --dport 80 -j ACCEPT

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
192.168.1.200/255.255.255.0 -j DNAT --to-destination
192.168.1.200:7100

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
192.168.1.201/255.255.255.0 -j DNAT --to-destination
192.168.1.201:7200

gratefull for any advice as it's not working

thx
 
Reply With Quote
 
 
 
 
Allan Bruce
Guest
Posts: n/a

 
      09-22-2003, 03:04 PM

"Eddie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I have a public facing box that also has a pseudo interface (please
> note real ip addresses have not been disclosed)
>
> eg: eth0 192.168.1.200
> eth0:1 192.168.1.201
>
> i have also registered a domain against each ip address
>
> eg: www.mydomain1.com forwards to 192.168.1.200:80
> www.mydomain2.com forwards to 192.168.1.201:80
>
> i am trying to set up some natting that will internally re-direct to a
> different port - based upon the distination address
>
> eg: for traffic hitting 192.168.1.200:80 -> 192.168.1.200:7100
> for traffic hitting 192.168.1.201:80 -> 192.168.1.201:7200
>
> here is my script:
>
> #!/bin/sh
>
> /sbin/iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
>
> /sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
> 192.168.1.200/255.255.255.0 -j DNAT --to-destination
> 192.168.1.200:7100
>
> /sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
> 192.168.1.201/255.255.255.0 -j DNAT --to-destination
> 192.168.1.201:7200
>
> gratefull for any advice as it's not working
>
> thx


You also need to set up a FORWARD rule - check out this NG a few days ago -
someone else had the exact same problem
Allan


 
Reply With Quote
 
Eddie
Guest
Posts: n/a

 
      09-24-2003, 10:55 AM
"Allan Bruce" <(E-Mail Removed)> wrote in message news:<bkn2ss$62h$(E-Mail Removed)>...
> "Eddie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
> > I have a public facing box that also has a pseudo interface (please
> > note real ip addresses have not been disclosed)
> >
> > eg: eth0 192.168.1.200
> > eth0:1 192.168.1.201
> >
> > i have also registered a domain against each ip address
> >
> > eg: www.mydomain1.com forwards to 192.168.1.200:80
> > www.mydomain2.com forwards to 192.168.1.201:80
> >
> > i am trying to set up some natting that will internally re-direct to a
> > different port - based upon the distination address
> >
> > eg: for traffic hitting 192.168.1.200:80 -> 192.168.1.200:7100
> > for traffic hitting 192.168.1.201:80 -> 192.168.1.201:7200
> >
> > here is my script:
> >
> > #!/bin/sh
> >
> > /sbin/iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
> >
> > /sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
> > 192.168.1.200/255.255.255.0 -j DNAT --to-destination
> > 192.168.1.200:7100
> >
> > /sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 --dst
> > 192.168.1.201/255.255.255.0 -j DNAT --to-destination
> > 192.168.1.201:7200
> >
> > gratefull for any advice as it's not working
> >
> > thx

>
> You also need to set up a FORWARD rule - check out this NG a few days ago -
> someone else had the exact same problem
> Allan


alan,

thanks for your response .... I tracked down the problem in the end
tho, ... script above was fine apart from the subnet mask should have
read 255.255.255.255 it was forwarding to the subnet :-(
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple MACs from same Interface OR MAC/VLAN NATting nikhil.subscribed@gmail.com Linux Networking 0 08-28-2006 10:02 AM
Strange problem: no problem with Linux, when I boot windows 2K network is down... Santa Linux Networking 11 11-29-2004 06:46 AM
IPSec NATTING and multiple firewalls Bernd Broadband Hardware 0 04-01-2004 10:06 AM
MSN Messenger Behind a NATting IPtables Firewall Meron Lavie Linux Networking 10 01-25-2004 12:48 PM
ftp routing / natting throu a RH7 firewall me Linux Networking 1 08-01-2003 04:01 PM



1 2 3 4 5 6 7 8 9 10 11