Linux Netfilter discussions
 help / color / mirror / Atom feed
* Two link adsl on the same server
@ 2005-05-10 16:32 Sebastião Antônio Campos (GWA)
  2005-05-10 17:08 ` ro0ot
  2005-05-10 17:30 ` Eduardo Spremolla
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastião Antônio Campos (GWA) @ 2005-05-10 16:32 UTC (permalink / raw)
  To: Netfilter list

Hi!

We have two ADSL link on the same server and we'd like to use load balance.

I tried to used, but I didn't have success.

I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 200.204.140.1
on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 200.179.1.1

This IP are static.

On my local network I have two servers (E-mail server and one web server) and I need to PREROUTING with DNAT.

And we would like to separate the port 80 and 21 using one link on eth0 and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.

My files:

My ifcfg-ethx files:

#NIC SIS on board, usando link1 ADSL
DEVICE=eth0
ONBOOT=yes
#BOOTPROTO=dhcp
BOOTPROTO=static
BROADCAST=200.168.1.63
IPADDR=200.168.1.19
NETMASK=255.255.255.192
NETWORK=200.168.1.0
#GATEWAY=200.168.1.1
___________________________________________________________
#Placa Realtek, Uso Local, slot 1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.17.1.6
BROADCAST=172.17.255.255
NETMASK=255.255.0.0
NETWORK=172.17.0.0
________________________________________________________
#NIC Realtek, link 2 ADSL
DEVICE=eth4
ONBOOT=yes
BOOTPROTO=static
BROADCAST=200.204.140.63
IPADDR=200.204.140.10
NETMASK=255.255.255.192
NETWORK=200.204.140.0

_________________________________________________
file /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=rbz-firewall
#GATEWAY=200.168.1.1
GATEWAY=200.204.140.1
___________________________________________________
file /etc/iproute2/rt_tables

#
# reserved values
#
#255    local
#254    main
#253    default
#0      unspec
 
#
# local
#
#1      inr.ruhep


Could some one help me??

Thanks


Sebastião Antônio Campos
Infojoi Computadores Ltda
89.224-000 Joinville -SC - R. Iririú, 3587
Cml. (47) 437-0796 - Cel. (47) 9927-5349
tiao@infojoi.com.br
http://www.lupusnet.com.br

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 16:32 Two link adsl on the same server Sebastião Antônio Campos (GWA)
@ 2005-05-10 17:08 ` ro0ot
  2005-05-10 23:58   ` Alexander Samad
                     ` (2 more replies)
  2005-05-10 17:30 ` Eduardo Spremolla
  1 sibling, 3 replies; 7+ messages in thread
From: ro0ot @ 2005-05-10 17:08 UTC (permalink / raw)
  To: "Sebastião Antônio Campos (GWA)"; +Cc: Netfilter list

Below is only examples: -

First, include this in /etc/iproute2/rt_tables as below: -

201 http.out
202 ftp.out
203 smtp.out
204 pop3.out

Next, include this in a preferred executable file such as 
/usr/local/bin/rc.routing as below: -

#!/bin/sh

# first ISP
ip route add 1.1.1.68/30 dev eth2 src 1.1.1.70 table 1
ip route add default via 1.1.1.69 table 1

# second ISP
ip route add 2.2.2.116/30 dev eth4 src 2.2.2.118 table 2
ip route add default via 2.2.2.117 table 2

ip rule add from 1.1.1.70 table 1
ip rule add from 2.2.2.118 table 2

ip route add 172.17.0.0/16 dev eth1 table 1
ip route add 2.2.2.116/30 dev eth4 table 1

ip route add 172.17.0.0/16 dev eth1 table 2
ip route add 1.1.1.68/30 dev eth2 table 2

ip route add default scope global nexthop via 1.1.1.70 dev eth2 nexthop 
via 2.2.2.118 dev eth4

ip rule add fwmark 1 table http.out
ip rule add fwmark 2 table ftp.out
ip rule add fwmark 3 table smtp.out
ip rule add fwmark 4 table pop3.out

ip route add default via 1.1.1.69 dev eth2 table http.out
ip route add default via 1.1.1.69 dev eth2 table ftp.out

ip route add default via 2.2.2.117 dev eth4 table smtp.out
ip route add default via 2.2.2.117 dev eth4 table pop3.out

Next, include this in a preferred executable file such as 
/usr/local/bin/rc.firewall as below: -

#!bin/sh

iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 1.1.1.70
iptables -t nat -A POSTROUTING -o eth4 -j SNAT --to-source 2.2.2.118

iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 80 -j MARK 
--set-mark 1
iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 21 -j MARK 
--set-mark 2
iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 25 -j MARK 
--set-mark 3
iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 110 -j MARK 
--set-mark 4

Hope it helps...

Regards,
ro0ot


Sebastião Antônio Campos (GWA) wrote:

>Hi!
>
>We have two ADSL link on the same server and we'd like to use load balance.
>
>I tried to used, but I didn't have success.
>
>I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
>on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 200.204.140.1
>on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 200.179.1.1
>
>This IP are static.
>
>On my local network I have two servers (E-mail server and one web server) and I need to PREROUTING with DNAT.
>
>And we would like to separate the port 80 and 21 using one link on eth0 and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.
>
>My files:
>
>My ifcfg-ethx files:
>
>#NIC SIS on board, usando link1 ADSL
>DEVICE=eth0
>ONBOOT=yes
>#BOOTPROTO=dhcp
>BOOTPROTO=static
>BROADCAST=200.168.1.63
>IPADDR=200.168.1.19
>NETMASK=255.255.255.192
>NETWORK=200.168.1.0
>#GATEWAY=200.168.1.1
>___________________________________________________________
>#Placa Realtek, Uso Local, slot 1
>DEVICE=eth1
>ONBOOT=yes
>BOOTPROTO=static
>IPADDR=172.17.1.6
>BROADCAST=172.17.255.255
>NETMASK=255.255.0.0
>NETWORK=172.17.0.0
>________________________________________________________
>#NIC Realtek, link 2 ADSL
>DEVICE=eth4
>ONBOOT=yes
>BOOTPROTO=static
>BROADCAST=200.204.140.63
>IPADDR=200.204.140.10
>NETMASK=255.255.255.192
>NETWORK=200.204.140.0
>
>_________________________________________________
>file /etc/sysconfig/network
>
>NETWORKING=yes
>HOSTNAME=rbz-firewall
>#GATEWAY=200.168.1.1
>GATEWAY=200.204.140.1
>___________________________________________________
>file /etc/iproute2/rt_tables
>
>#
># reserved values
>#
>#255    local
>#254    main
>#253    default
>#0      unspec
> 
>#
># local
>#
>#1      inr.ruhep
>
>
>Could some one help me??
>
>Thanks
>
>
>Sebastião Antônio Campos
>Infojoi Computadores Ltda
>89.224-000 Joinville -SC - R. Iririú, 3587
>Cml. (47) 437-0796 - Cel. (47) 9927-5349
>tiao@infojoi.com.br
>http://www.lupusnet.com.br
>
>
>  
>





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 16:32 Two link adsl on the same server Sebastião Antônio Campos (GWA)
  2005-05-10 17:08 ` ro0ot
@ 2005-05-10 17:30 ` Eduardo Spremolla
  1 sibling, 0 replies; 7+ messages in thread
From: Eduardo Spremolla @ 2005-05-10 17:30 UTC (permalink / raw)
  To: Sebastião Antônio Campos \(GWA\); +Cc: Netfilter list

You can only do load balancing on outgoing traffic, to balance incoming
traffic, you need to use different names->

	www.your_org.com  eth0 200.168.1.19
        mail.your_org.com eth4 200.204.140.10

For the outgoing traffic use mangle PREROUTING to mark the packets
acording to the source server and use 2 ip route tables. 


LALO  

On Tue, 2005-05-10 at 13:32 -0300, Sebastião Antônio Campos (GWA) wrote:
> Hi!
> 
> We have two ADSL link on the same server and we'd like to use load balance.
> 
> I tried to used, but I didn't have success.
> 
> I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
> on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 200.204.140.1
> on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 200.179.1.1
> 
> This IP are static.
> 
> On my local network I have two servers (E-mail server and one web server) and I need to PREROUTING with DNAT.
> 
> And we would like to separate the port 80 and 21 using one link on eth0 and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.
> 
> My files:
> 
> My ifcfg-ethx files:
> 
> #NIC SIS on board, usando link1 ADSL
> DEVICE=eth0
> ONBOOT=yes
> #BOOTPROTO=dhcp
> BOOTPROTO=static
> BROADCAST=200.168.1.63
> IPADDR=200.168.1.19
> NETMASK=255.255.255.192
> NETWORK=200.168.1.0
> #GATEWAY=200.168.1.1
> ___________________________________________________________
> #Placa Realtek, Uso Local, slot 1
> DEVICE=eth1
> ONBOOT=yes
> BOOTPROTO=static
> IPADDR=172.17.1.6
> BROADCAST=172.17.255.255
> NETMASK=255.255.0.0
> NETWORK=172.17.0.0
> ________________________________________________________
> #NIC Realtek, link 2 ADSL
> DEVICE=eth4
> ONBOOT=yes
> BOOTPROTO=static
> BROADCAST=200.204.140.63
> IPADDR=200.204.140.10
> NETMASK=255.255.255.192
> NETWORK=200.204.140.0
> 
> _________________________________________________
> file /etc/sysconfig/network
> 
> NETWORKING=yes
> HOSTNAME=rbz-firewall
> #GATEWAY=200.168.1.1
> GATEWAY=200.204.140.1
> ___________________________________________________
> file /etc/iproute2/rt_tables
> 
> #
> # reserved values
> #
> #255    local
> #254    main
> #253    default
> #0      unspec
>  
> #
> # local
> #
> #1      inr.ruhep
> 
> 
> Could some one help me??
> 
> Thanks
> 
> 
> Sebastião Antônio Campos
> Infojoi Computadores Ltda
> 89.224-000 Joinville -SC - R. Iririú, 3587
> Cml. (47) 437-0796 - Cel. (47) 9927-5349
> tiao@infojoi.com.br
> http://www.lupusnet.com.br
-- 
Ing. Eduardo Spremolla
Jefe I+D
Antel
Uruguay


Este e-mail y cualquier posible archivo adjunto está dirigido únicamente al destinatario del mensaje y contiene información que puede ser confidencial. Si Ud. no es el destinatario correcto por favor notifique al remitente respondiendo este mensaje y elimine inmediatamente el e-mail y los posibles archivos adjuntos al mismo de su sistema. Está prohibida cualquier utilización, difusión o copia de este e-mail por cualquier persona o entidad que no sean las específicas destinatarias del mensaje. ANTEL no acepta ninguna responsabilidad con respecto a cualquier comunicación que haya sido emitida incumpliendo nuestra Política de Seguridad de la Información.
. . . . . . . . .
This e-mail and any attachment is confidential and is intended solely for the addressee(s). If you are not intended recipient please inform the sender inmediately, answering this e-mail and delete it as well as the attached files. Any use, circulation or copy of this e-mail by any person or entity that not is the specific addressee(s) is prohibited. ANTEL is not responsible for any communication emitted without respecting our Information Security Policy.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 17:08 ` ro0ot
@ 2005-05-10 23:58   ` Alexander Samad
  2005-05-11 14:46     ` ro0ot
  2005-05-11  5:37   ` Sebastião Antônio Campos (GWA)
  2005-05-11  7:22   ` Christoph Georgi
  2 siblings, 1 reply; 7+ messages in thread
From: Alexander Samad @ 2005-05-10 23:58 UTC (permalink / raw)
  To: netfilter

[-- Attachment #1: Type: text/plain, Size: 4491 bytes --]

On Wed, May 11, 2005 at 01:08:37AM +0800, ro0ot wrote:
> Below is only examples: -
> 
> First, include this in /etc/iproute2/rt_tables as below: -
> 
> 201 http.out
> 202 ftp.out
> 203 smtp.out
> 204 pop3.out
> 
> Next, include this in a preferred executable file such as 
> /usr/local/bin/rc.routing as below: -
> 
> #!/bin/sh
> 
> # first ISP
> ip route add 1.1.1.68/30 dev eth2 src 1.1.1.70 table 1
> ip route add default via 1.1.1.69 table 1
> 
> # second ISP
> ip route add 2.2.2.116/30 dev eth4 src 2.2.2.118 table 2
> ip route add default via 2.2.2.117 table 2

you also need to add the local routes in these tables as well, otherwise
they will not be able to talk inside !


> 
> ip rule add from 1.1.1.70 table 1
> ip rule add from 2.2.2.118 table 2
> 
> ip route add 172.17.0.0/16 dev eth1 table 1
> ip route add 2.2.2.116/30 dev eth4 table 1
> 
> ip route add 172.17.0.0/16 dev eth1 table 2
> ip route add 1.1.1.68/30 dev eth2 table 2
> 
> ip route add default scope global nexthop via 1.1.1.70 dev eth2 nexthop 
> via 2.2.2.118 dev eth4
> 
> ip rule add fwmark 1 table http.out
> ip rule add fwmark 2 table ftp.out
> ip rule add fwmark 3 table smtp.out
> ip rule add fwmark 4 table pop3.out
> 
> ip route add default via 1.1.1.69 dev eth2 table http.out
> ip route add default via 1.1.1.69 dev eth2 table ftp.out
> 
> ip route add default via 2.2.2.117 dev eth4 table smtp.out
> ip route add default via 2.2.2.117 dev eth4 table pop3.out
> 
> Next, include this in a preferred executable file such as 
> /usr/local/bin/rc.firewall as below: -
> 
> #!bin/sh
> 
> iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 1.1.1.70
> iptables -t nat -A POSTROUTING -o eth4 -j SNAT --to-source 2.2.2.118
> 
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 80 -j MARK 
> --set-mark 1
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 21 -j MARK 
> --set-mark 2
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 25 -j MARK 
> --set-mark 3
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 110 -j MARK 
> --set-mark 4
> 
> Hope it helps...
> 
> Regards,
> ro0ot
> 
> 
> Sebasti?o Ant?nio Campos (GWA) wrote:
> 
> >Hi!
> >
> >We have two ADSL link on the same server and we'd like to use load balance.
> >
> >I tried to used, but I didn't have success.
> >
> >I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
> >on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 
> >200.204.140.1
> >on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 
> >200.179.1.1
> >
> >This IP are static.
> >
> >On my local network I have two servers (E-mail server and one web server) 
> >and I need to PREROUTING with DNAT.
> >
> >And we would like to separate the port 80 and 21 using one link on eth0 
> >and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.
> >
> >My files:
> >
> >My ifcfg-ethx files:
> >
> >#NIC SIS on board, usando link1 ADSL
> >DEVICE=eth0
> >ONBOOT=yes
> >#BOOTPROTO=dhcp
> >BOOTPROTO=static
> >BROADCAST=200.168.1.63
> >IPADDR=200.168.1.19
> >NETMASK=255.255.255.192
> >NETWORK=200.168.1.0
> >#GATEWAY=200.168.1.1
> >___________________________________________________________
> >#Placa Realtek, Uso Local, slot 1
> >DEVICE=eth1
> >ONBOOT=yes
> >BOOTPROTO=static
> >IPADDR=172.17.1.6
> >BROADCAST=172.17.255.255
> >NETMASK=255.255.0.0
> >NETWORK=172.17.0.0
> >________________________________________________________
> >#NIC Realtek, link 2 ADSL
> >DEVICE=eth4
> >ONBOOT=yes
> >BOOTPROTO=static
> >BROADCAST=200.204.140.63
> >IPADDR=200.204.140.10
> >NETMASK=255.255.255.192
> >NETWORK=200.204.140.0
> >
> >_________________________________________________
> >file /etc/sysconfig/network
> >
> >NETWORKING=yes
> >HOSTNAME=rbz-firewall
> >#GATEWAY=200.168.1.1
> >GATEWAY=200.204.140.1
> >___________________________________________________
> >file /etc/iproute2/rt_tables
> >
> >#
> ># reserved values
> >#
> >#255    local
> >#254    main
> >#253    default
> >#0      unspec
> >
> >#
> ># local
> >#
> >#1      inr.ruhep
> >
> >
> >Could some one help me??
> >
> >Thanks
> >
> >
> >Sebasti?o Ant?nio Campos
> >Infojoi Computadores Ltda
> >89.224-000 Joinville -SC - R. Iriri?, 3587
> >Cml. (47) 437-0796 - Cel. (47) 9927-5349
> >tiao@infojoi.com.br
> >http://www.lupusnet.com.br
> >
> >
> > 
> >
> 
> 
> 
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 17:08 ` ro0ot
  2005-05-10 23:58   ` Alexander Samad
@ 2005-05-11  5:37   ` Sebastião Antônio Campos (GWA)
  2005-05-11  7:22   ` Christoph Georgi
  2 siblings, 0 replies; 7+ messages in thread
From: Sebastião Antônio Campos (GWA) @ 2005-05-11  5:37 UTC (permalink / raw)
  To: ro0ot; +Cc: Netfilter list

Hi RoOot,

I did the tip and something works and other not.

I could not access from (2.2.2.118) the internet the ftp service that is 
located in other server.

I have this iptable rule:
iptables -A PREROUTING -t nat -p tcp -d 1.1.1.70 --dport 21 -j DNAT --to 
172.17.1.7

iptables  -A PREROUTING -t nat -p tcp -d 2.2.2.118 --dport 21 -j DNAT --to 
172.17.1.7



Only if I use the 1.1.1.70 it works because there is a default route 
1.1.1.69. If I del the route and add the other default route to the 
2.2.2.118 (2.2.2.117) it works too, but the other stop to work.

Any other service in the firewall I can access via 1.1.1.70 or 2.2.2.118.

What I need to do to access the ftp service from 1.1.1.70 or 2.2.2.118.


Thanks

Tião

----- Original Message ----- 
From: "ro0ot" <ro0ot@phreaker.net>
To: ""Sebastião Antônio Campos (GWA)"" <sa.campos@datasulsp.com.br>
Cc: "Netfilter list" <netfilter@lists.netfilter.org>
Sent: Tuesday, May 10, 2005 2:08 PM
Subject: Re: Two link adsl on the same server


> Below is only examples: -
>
> First, include this in /etc/iproute2/rt_tables as below: -
>
> 201 http.out
> 202 ftp.out
> 203 smtp.out
> 204 pop3.out
>
> Next, include this in a preferred executable file such as 
> /usr/local/bin/rc.routing as below: -
>
> #!/bin/sh
>
> # first ISP
> ip route add 1.1.1.68/30 dev eth2 src 1.1.1.70 table 1
> ip route add default via 1.1.1.69 table 1
>
> # second ISP
> ip route add 2.2.2.116/30 dev eth4 src 2.2.2.118 table 2
> ip route add default via 2.2.2.117 table 2
>
> ip rule add from 1.1.1.70 table 1
> ip rule add from 2.2.2.118 table 2
>
> ip route add 172.17.0.0/16 dev eth1 table 1
> ip route add 2.2.2.116/30 dev eth4 table 1
>
> ip route add 172.17.0.0/16 dev eth1 table 2
> ip route add 1.1.1.68/30 dev eth2 table 2
>
> ip route add default scope global nexthop via 1.1.1.70 dev eth2 nexthop 
> via 2.2.2.118 dev eth4
>
> ip rule add fwmark 1 table http.out
> ip rule add fwmark 2 table ftp.out
> ip rule add fwmark 3 table smtp.out
> ip rule add fwmark 4 table pop3.out
>
> ip route add default via 1.1.1.69 dev eth2 table http.out
> ip route add default via 1.1.1.69 dev eth2 table ftp.out
>
> ip route add default via 2.2.2.117 dev eth4 table smtp.out
> ip route add default via 2.2.2.117 dev eth4 table pop3.out
>
> Next, include this in a preferred executable file such as 
> /usr/local/bin/rc.firewall as below: -
>
> #!bin/sh
>
> iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 1.1.1.70
> iptables -t nat -A POSTROUTING -o eth4 -j SNAT --to-source 2.2.2.118
>
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 80 -j 
> MARK --set-mark 1
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 21 -j 
> MARK --set-mark 2
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 25 -j 
> MARK --set-mark 3
> iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 110 -j 
> MARK --set-mark 4
>
> Hope it helps...
>
> Regards,
> ro0ot
>
>
> Sebastião Antônio Campos (GWA) wrote:
>
>>Hi!
>>
>>We have two ADSL link on the same server and we'd like to use load 
>>balance.
>>
>>I tried to used, but I didn't have success.
>>
>>I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
>>on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 
>>200.204.140.1
>>on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 
>>200.179.1.1
>>
>>This IP are static.
>>
>>On my local network I have two servers (E-mail server and one web server) 
>>and I need to PREROUTING with DNAT.
>>
>>And we would like to separate the port 80 and 21 using one link on eth0 
>>and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.
>>
>>My files:
>>
>>My ifcfg-ethx files:
>>
>>#NIC SIS on board, usando link1 ADSL
>>DEVICE=eth0
>>ONBOOT=yes
>>#BOOTPROTO=dhcp
>>BOOTPROTO=static
>>BROADCAST=200.168.1.63
>>IPADDR=200.168.1.19
>>NETMASK=255.255.255.192
>>NETWORK=200.168.1.0
>>#GATEWAY=200.168.1.1
>>___________________________________________________________
>>#Placa Realtek, Uso Local, slot 1
>>DEVICE=eth1
>>ONBOOT=yes
>>BOOTPROTO=static
>>IPADDR=172.17.1.6
>>BROADCAST=172.17.255.255
>>NETMASK=255.255.0.0
>>NETWORK=172.17.0.0
>>________________________________________________________
>>#NIC Realtek, link 2 ADSL
>>DEVICE=eth4
>>ONBOOT=yes
>>BOOTPROTO=static
>>BROADCAST=200.204.140.63
>>IPADDR=200.204.140.10
>>NETMASK=255.255.255.192
>>NETWORK=200.204.140.0
>>
>>_________________________________________________
>>file /etc/sysconfig/network
>>
>>NETWORKING=yes
>>HOSTNAME=rbz-firewall
>>#GATEWAY=200.168.1.1
>>GATEWAY=200.204.140.1
>>___________________________________________________
>>file /etc/iproute2/rt_tables
>>
>>#
>># reserved values
>>#
>>#255    local
>>#254    main
>>#253    default
>>#0      unspec
>> #
>># local
>>#
>>#1      inr.ruhep
>>
>>
>>Could some one help me??
>>
>>Thanks
>>
>>
>>Sebastião Antônio Campos
>>Infojoi Computadores Ltda
>>89.224-000 Joinville -SC - R. Iririú, 3587
>>Cml. (47) 437-0796 - Cel. (47) 9927-5349
>>tiao@infojoi.com.br
>>http://www.lupusnet.com.br
>>
>>
>>
>
>
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 17:08 ` ro0ot
  2005-05-10 23:58   ` Alexander Samad
  2005-05-11  5:37   ` Sebastião Antônio Campos (GWA)
@ 2005-05-11  7:22   ` Christoph Georgi
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Georgi @ 2005-05-11  7:22 UTC (permalink / raw)
  To: ro0ot; +Cc: Netfilter list

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I don't quite get, why this has to be made so "complicated". I have two
uplinks and do the following:

Mark the traffic according to the uplink that I want to use
* no mark -> default/non-priority traffic
* -j MARK 1 for priority traffic (over the fast line, usually ISP 1)
* -j MARK 2 for traffic always over ISP 1
* -j MARK 3 for traffic always over ISP 2

Accordingly I have four routing tables:
* 201 for priority traffic just containing
~  'default via <gateway of isp 1> dev eth0
* 202 for traffic static over ISP 1
~  'default via <gateway of isp 1> dev eth0
* 203 for traffic static over ISP 2
~  'defualt via <gateway of isp 2> dev ppp0
* default routing table (254)
~  after all the "strange" entries
~  'default via <gateway of isp 2> dev ppp0

I have to SNAT the traffic that is routed via the priority table (201)
and the 202 table, as the kernel uses the IP of the ISP in the default
routing table (254) as source, and I have to disable rp_filters. No more
fancy routing stuff set up.. And everything works fine.

Am I missing an important point?

thanks
.christoph


ro0ot wrote:
| Below is only examples: -
|
[...]

- --


Christoph Georgi
- -----------------------------
email.  christoph.georgi@web.de
fon.	+64 (0)9 815 8259

registered linux user #380268
ubuntu 5.04 (ubuntu.com)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCgbJ/gQyJJUB4UhwRAgZgAKCDhqb6b/uBlALc8JNdhfnEe69aQwCg7QS6
HQmCzmKJMLTvnQ7UanmYicA=
=t3Ur
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two link adsl on the same server
  2005-05-10 23:58   ` Alexander Samad
@ 2005-05-11 14:46     ` ro0ot
  0 siblings, 0 replies; 7+ messages in thread
From: ro0ot @ 2005-05-11 14:46 UTC (permalink / raw)
  To: Alexander Samad; +Cc: netfilter

Alexander Samad wrote:

>On Wed, May 11, 2005 at 01:08:37AM +0800, ro0ot wrote:
>  
>
>>Below is only examples: -
>>
>>First, include this in /etc/iproute2/rt_tables as below: -
>>
>>201 http.out
>>202 ftp.out
>>203 smtp.out
>>204 pop3.out
>>
>>Next, include this in a preferred executable file such as 
>>/usr/local/bin/rc.routing as below: -
>>
>>#!/bin/sh
>>
>># first ISP
>>ip route add 1.1.1.68/30 dev eth2 src 1.1.1.70 table 1
>>ip route add default via 1.1.1.69 table 1
>>
>># second ISP
>>ip route add 2.2.2.116/30 dev eth4 src 2.2.2.118 table 2
>>ip route add default via 2.2.2.117 table 2
>>    
>>
>
>you also need to add the local routes in these tables as well, otherwise
>they will not be able to talk inside !
>  
>
Any example for the local routes?

>
>  
>
>>ip rule add from 1.1.1.70 table 1
>>ip rule add from 2.2.2.118 table 2
>>
>>ip route add 172.17.0.0/16 dev eth1 table 1
>>ip route add 2.2.2.116/30 dev eth4 table 1
>>
>>ip route add 172.17.0.0/16 dev eth1 table 2
>>ip route add 1.1.1.68/30 dev eth2 table 2
>>
>>ip route add default scope global nexthop via 1.1.1.70 dev eth2 nexthop 
>>via 2.2.2.118 dev eth4
>>
>>ip rule add fwmark 1 table http.out
>>ip rule add fwmark 2 table ftp.out
>>ip rule add fwmark 3 table smtp.out
>>ip rule add fwmark 4 table pop3.out
>>
>>ip route add default via 1.1.1.69 dev eth2 table http.out
>>ip route add default via 1.1.1.69 dev eth2 table ftp.out
>>
>>ip route add default via 2.2.2.117 dev eth4 table smtp.out
>>ip route add default via 2.2.2.117 dev eth4 table pop3.out
>>
>>Next, include this in a preferred executable file such as 
>>/usr/local/bin/rc.firewall as below: -
>>
>>#!bin/sh
>>
>>iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 1.1.1.70
>>iptables -t nat -A POSTROUTING -o eth4 -j SNAT --to-source 2.2.2.118
>>
>>iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 80 -j MARK 
>>--set-mark 1
>>iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 21 -j MARK 
>>--set-mark 2
>>iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 25 -j MARK 
>>--set-mark 3
>>iptables -t mangle -A PREROUTING -i eth1 -p tcp --dport 110 -j MARK 
>>--set-mark 4
>>
>>Hope it helps...
>>
>>Regards,
>>ro0ot
>>
>>
>>Sebasti?o Ant?nio Campos (GWA) wrote:
>>
>>    
>>
>>>Hi!
>>>
>>>We have two ADSL link on the same server and we'd like to use load balance.
>>>
>>>I tried to used, but I didn't have success.
>>>
>>>I use on eth1 172.17.1.6 mask 255.255.0.0 my local network;
>>>on eth2 my first ADSL 200.168.1.19 mask 255.255.255.192 default gw 
>>>200.204.140.1
>>>on eth4 my first ADSL 200.204.140.10 mask 255.255.255.192 default gw 
>>>200.179.1.1
>>>
>>>This IP are static.
>>>
>>>On my local network I have two servers (E-mail server and one web server) 
>>>and I need to PREROUTING with DNAT.
>>>
>>>And we would like to separate the port 80 and 21 using one link on eth0 
>>>and the port 25 and 110 other link eth4 and other ports eth0 or eth4 link.
>>>
>>>My files:
>>>
>>>My ifcfg-ethx files:
>>>
>>>#NIC SIS on board, usando link1 ADSL
>>>DEVICE=eth0
>>>ONBOOT=yes
>>>#BOOTPROTO=dhcp
>>>BOOTPROTO=static
>>>BROADCAST=200.168.1.63
>>>IPADDR=200.168.1.19
>>>NETMASK=255.255.255.192
>>>NETWORK=200.168.1.0
>>>#GATEWAY=200.168.1.1
>>>___________________________________________________________
>>>#Placa Realtek, Uso Local, slot 1
>>>DEVICE=eth1
>>>ONBOOT=yes
>>>BOOTPROTO=static
>>>IPADDR=172.17.1.6
>>>BROADCAST=172.17.255.255
>>>NETMASK=255.255.0.0
>>>NETWORK=172.17.0.0
>>>________________________________________________________
>>>#NIC Realtek, link 2 ADSL
>>>DEVICE=eth4
>>>ONBOOT=yes
>>>BOOTPROTO=static
>>>BROADCAST=200.204.140.63
>>>IPADDR=200.204.140.10
>>>NETMASK=255.255.255.192
>>>NETWORK=200.204.140.0
>>>
>>>_________________________________________________
>>>file /etc/sysconfig/network
>>>
>>>NETWORKING=yes
>>>HOSTNAME=rbz-firewall
>>>#GATEWAY=200.168.1.1
>>>GATEWAY=200.204.140.1
>>>___________________________________________________
>>>file /etc/iproute2/rt_tables
>>>
>>>#
>>># reserved values
>>>#
>>>#255    local
>>>#254    main
>>>#253    default
>>>#0      unspec
>>>
>>>#
>>># local
>>>#
>>>#1      inr.ruhep
>>>
>>>
>>>Could some one help me??
>>>
>>>Thanks
>>>
>>>
>>>Sebasti?o Ant?nio Campos
>>>Infojoi Computadores Ltda
>>>89.224-000 Joinville -SC - R. Iriri?, 3587
>>>Cml. (47) 437-0796 - Cel. (47) 9927-5349
>>>tiao@infojoi.com.br
>>>http://www.lupusnet.com.br
>>>
>>>
>>>
>>>
>>>      
>>>
>>
>>
>>
>>    
>>





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-11 14:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 16:32 Two link adsl on the same server Sebastião Antônio Campos (GWA)
2005-05-10 17:08 ` ro0ot
2005-05-10 23:58   ` Alexander Samad
2005-05-11 14:46     ` ro0ot
2005-05-11  5:37   ` Sebastião Antônio Campos (GWA)
2005-05-11  7:22   ` Christoph Georgi
2005-05-10 17:30 ` Eduardo Spremolla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox