Networking Forums

Networking Forums > Computer Networking > Linux Networking > Redirect outbound traffic with IPTABLEs

Reply
Thread Tools Display Modes

Redirect outbound traffic with IPTABLEs

 
 
TravisT
Guest
Posts: n/a

 
      05-01-2006, 05:15 PM
Hello All,

From what I have read, I can see that what I want to do is possible,
but not quite sure how to implement it.

I want to route all outbound HTTP traffic on 8080 and HTTPS 8443 to
192.168.15.113 gateway (load balancer) and all other traffic to
192.168.15.1.

What rules would I create and can yout ell me briefly why you shose the
options you did. I cannot determine why I would use PREROUTING along
with DNAT, or whatever.

Thanks in advance.

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      05-01-2006, 05:57 PM
On 2006-05-01, TravisT <(E-Mail Removed)> wrote:
> I want to route all outbound HTTP traffic on 8080 and HTTPS 8443 to
> 192.168.15.113 gateway (load balancer) and all other traffic to
> 192.168.15.1.


Outbound? So, traffic that came from your machine, towards external
IPs?

(very quickly and without too much checking):

iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8080 \
--to 192.168.15.113
iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8443 \
--to 192.168.15.1

> I cannot determine why I would use PREROUTING along
> with DNAT, or whatever.


Because that's the way to do it.

Davide

--
Sanity is like money; you should just have enough to get by. Any more
and you turn into a freak. --rone
 
Reply With Quote
 
TravisT
Guest
Posts: n/a

 
      05-01-2006, 06:40 PM

Davide Bianchi wrote:
> On 2006-05-01, TravisT <(E-Mail Removed)> wrote:
> > I want to route all outbound HTTP traffic on 8080 and HTTPS 8443 to
> > 192.168.15.113 gateway (load balancer) and all other traffic to
> > 192.168.15.1.

>
> Outbound? So, traffic that came from your machine, towards external
> IPs?
>
> (very quickly and without too much checking):
>
> iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8080 \
> --to 192.168.15.113
> iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8443 \
> --to 192.168.15.1
>


There are numerous syntax errors hwere that I was not able to resolve.

I changesthe -a to a -A and I can;t use --dport unless I specify -p
tcp, but I think there is more missing. Still won't work.


> > I cannot determine why I would use PREROUTING along
> > with DNAT, or whatever.

>
> Because that's the way to do it.
>
> Davide
>
> --
> Sanity is like money; you should just have enough to get by. Any more
> and you turn into a freak. --rone


 
Reply With Quote
 
Grant
Guest
Posts: n/a

 
      05-01-2006, 09:30 PM
On 1 May 2006 11:40:15 -0700, "TravisT" <(E-Mail Removed)> wrote:

>
>Davide Bianchi wrote:
>> On 2006-05-01, TravisT <(E-Mail Removed)> wrote:
>> > I want to route all outbound HTTP traffic on 8080 and HTTPS 8443 to
>> > 192.168.15.113 gateway (load balancer) and all other traffic to
>> > 192.168.15.1.

>>
>> Outbound? So, traffic that came from your machine, towards external
>> IPs?
>>
>> (very quickly and without too much checking):
>>
>> iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8080 \
>> --to 192.168.15.113
>> iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8443 \
>> --to 192.168.15.1
>>

>
>There are numerous syntax errors hwere that I was not able to resolve.


iptables -t nat -A PREROUTING ...

Grant.
--
Memory fault -- brain fried
 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      05-01-2006, 11:41 PM
In article <(E-Mail Removed) >,
Davide Bianchi <(E-Mail Removed)> wrote:
:On 2006-05-01, TravisT <(E-Mail Removed)> wrote:
:> I want to route all outbound HTTP traffic on 8080 and HTTPS 8443 to
:> 192.168.15.113 gateway (load balancer) and all other traffic to
:> 192.168.15.1.
:
:Outbound? So, traffic that came from your machine, towards external
:IPs?
:
very quickly and without too much checking):
:
:iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8080 \
: --to 192.168.15.113
:iptables -a PREROUTING -o <yourexternalinterfacehere> --dport 8443 \
: --to 192.168.15.1

Ummm, no. Unless I completely misunderstand his intent, the OP doesn't
want to change the destination address, just the outgoing gateway.
That's a job for Policy Routing, not iptables. See the manpage for the
"ip" command. You're probably going to need help that I don't have
enough knowledge to give. A Google search for

linux "policy routing"

yields a lot leads. Here's one that looks promising:

http://www.linux.com/howtos/Adv-Rout...rtc.rpdb.shtml

--
Bob Nichols AT comcast.net I am "RNichols42"
 
Reply With Quote
 
TravisT
Guest
Posts: n/a

 
      05-02-2006, 02:32 PM
No, I am only changing the gateay for certain traffic. What was said
above I finally got to work.

 
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
50Mbps outbound traffic from Port 80 Chris Windows Networking 2 08-10-2006 08:55 PM
IP Alias & IPtables, redirecting outbound traffic out specific interfaces paul.groth@gmail.com Linux Networking 1 05-09-2006 05:45 AM
IPTables filtering what should be allowed outbound traffic SmittyBroham Linux Networking 6 10-03-2005 05:42 PM
iptables? redirect? M3ntos Linux Networking 3 05-20-2005 08:16 AM
Logging outbound traffic on a W3K router... Pradeep Windows Networking 1 11-02-2004 02:01 AM



1 2 3 4 5 6 7 8 9 10 11