[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Roteamento pela origem



Ola Anderson, mais uma vez agradeço pela ajuda...
Abaixo o contador de pacotes antes. e mais abaixo depois de varias tentativas de conexao:

Chain PREROUTING (policy ACCEPT 20727 packets, 13M bytes)
 pkts bytes target     prot opt in     out     source               destination
  953  172K TO_MARK    0    --  eth2   *       0.0.0.0/0            0.0.0.0/0

Chain INPUT (policy ACCEPT 2487 packets, 291K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 18743 packets, 13M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1371 packets, 205K bytes)
 pkts bytes target     prot opt in     out     source               destination
  258 42432 TO_MARK    0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain POSTROUTING (policy ACCEPT 20099 packets, 13M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain MARK_EMBRATEL (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x66
    0     0 ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain MARK_VELOX (1 references)
 pkts bytes target     prot opt in     out     source               destination
 1211  214K MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x65
 1211  214K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain TO_MARK (2 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MARK_EMBRATEL  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp spt:3389
 1211  214K MARK_VELOX  0    --  *      *       0.0.0.0/0            0.0.0.0/0

==========================================================================

Chain PREROUTING (policy ACCEPT 22190 packets, 14M bytes)
 pkts bytes target     prot opt in     out     source               destination
 2462  473K TO_MARK    0    --  eth2   *       0.0.0.0/0            0.0.0.0/0

Chain INPUT (policy ACCEPT 2859 packets, 331K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 21210 packets, 14M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1371 packets, 205K bytes)
 pkts bytes target     prot opt in     out     source               destination
  488  142K TO_MARK    0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain POSTROUTING (policy ACCEPT 22742 packets, 15M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain MARK_EMBRATEL (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x66
    0     0 ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain MARK_VELOX (1 references)
 pkts bytes target     prot opt in     out     source               destination
 2950  615K MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x65
 2950  615K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain TO_MARK (2 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MARK_EMBRATEL  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp spt:3389
 2950  615K MARK_VELOX  0    --  *      *       0.0.0.0/0            0.0.0.0/0



RESULTADO DO ip rule show
0:      from all lookup 255
32762:  from 200.172.237.128/26 lookup embratel
32763:  from 192.168.1.2 lookup velox
32764:  from all fwmark 0x66 lookup embratel
32765:  from all fwmark 0x65 lookup velox
32766:  from all lookup main
32767:  from all lookup default

ip route show
200.172.237.128/26 dev eth0  proto kernel  scope link  src 200.172.237.140
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.2
192.168.0.0/24 dev eth2  proto kernel  scope link  src 192.168.0.254
default via 192.168.1.1 dev eth1

ip route show table velox
200.172.237.128/26 dev eth0  proto kernel  scope link  src 200.172.237.140
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.2
192.168.0.0/24 dev eth2  proto kernel  scope link  src 192.168.0.254
default via 192.168.1.1 dev eth1

ip route show table embratel
200.172.237.128/26 dev eth0  proto kernel  scope link  src 200.172.237.140
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.2
192.168.0.0/24 dev eth2  proto kernel  scope link  src 192.168.0.254
default via 200.172.237.130 dev eth0

iptables -t mangle -nvL --line-numbers
Chain PREROUTING (policy ACCEPT 33879 packets, 25M bytes)
num   pkts bytes target     prot opt in     out     source               destination
1    13063 2483K TO_MARK    0    --  eth2   *       0.0.0.0/0            0.0.0.0/0

Chain INPUT (policy ACCEPT 4919 packets, 533K bytes)
num   pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 40976 packets, 27M bytes)
num   pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1371 packets, 205K bytes)
num   pkts bytes target     prot opt in     out     source               destination
1     2001  494K TO_MARK    0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain POSTROUTING (policy ACCEPT 43725 packets, 28M bytes)
num   pkts bytes target     prot opt in     out     source               destination

Chain MARK_EMBRATEL (1 references)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x66
2        0     0 ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain MARK_VELOX (1 references)
num   pkts bytes target     prot opt in     out     source               destination
1    15064 2977K MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           MARK set 0x65
2    15064 2977K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain TO_MARK (2 references)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 MARK_EMBRATEL  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp spt:3389
2    15064 2977K MARK_VELOX  0    --  *      *       0.0.0.0/0            0.0.0.0/0


iptables -t filter -nvL --line-numbers
Chain INPUT (policy ACCEPT 54 packets, 2808 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1      785 62396 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
2       14  1638 ACCEPT     0    --  lo     *       0.0.0.0/0            0.0.0.0/0
3        6   256 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID
4        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 limit: avg 1/sec burst 5
5        0     0 DROP       0    --  eth0   *       10.0.0.0/8           0.0.0.0/0
6        0     0 DROP       0    --  eth0   *       127.0.0.0/8          0.0.0.0/0
7        0     0 DROP       0    --  eth0   *       172.16.0.0/12        0.0.0.0/0
8        0     0 DROP       0    --  eth0   *       192.168.0.0/16       0.0.0.0/0
9        0     0 DROP       0    --  eth1   *       10.0.0.0/8           0.0.0.0/0
10       0     0 DROP       0    --  eth1   *       127.0.0.0/8          0.0.0.0/0
11       0     0 DROP       0    --  eth1   *       172.16.0.0/12        0.0.0.0/0
12       0     0 DROP       0    --  eth1   *       192.168.0.0/16       0.0.0.0/0
13       0     0 DROP       0    --  *      *       224.0.0.0/8          0.0.0.0/0
14       0     0 DROP       0    --  *      *       0.0.0.0/0            224.0.0.0/8
15       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:31337
16       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:31337
17       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpts:12345:12346
18       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpts:12345:12346
19       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:1524
20       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:27665
21       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:27444
22       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:31335
23       0     0 DROP       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpts:33435:33525
24       0     0 DROP       udp  --  eth1   *       0.0.0.0/0            0.0.0.0/0           udp dpts:33435:33525
25       0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x04 limit: avg 1/sec burst 5
26    1297  113K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
27       0     0 ACCEPT     tcp  --  *      *       192.168.0.0/24       200.172.237.138     tcp dpt:22
28       0     0 ACCEPT     tcp  --  *      *       201.78.45.253        200.172.237.138     tcp dpt:22
29       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 0
30       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3
31       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 5
32       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8
33       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11
34       0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            200.172.237.170     udp dpt:53
35       0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            200.172.237.171     udp dpt:53
36     142 11306 ACCEPT     udp  --  *      *       0.0.0.0/0            192.168.0.254       udp dpt:53
37       0     0 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:3128
38       0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            200.172.237.169     tcp dpt:21
39     810  115K DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        7   280 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID
2        2   168 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 limit: avg 1/sec burst 5
3        0     0 DROP       0    --  eth0   *       10.0.0.0/8           0.0.0.0/0
4        0     0 DROP       0    --  eth0   *       127.0.0.0/8          0.0.0.0/0
5        0     0 DROP       0    --  eth0   *       172.16.0.0/12        0.0.0.0/0
6        0     0 DROP       0    --  eth0   *       192.168.0.0/16       0.0.0.0/0
7        0     0 DROP       0    --  eth1   *       10.0.0.0/8           0.0.0.0/0
8        0     0 DROP       0    --  eth1   *       127.0.0.0/8          0.0.0.0/0
9        0     0 DROP       0    --  eth1   *       172.16.0.0/12        0.0.0.0/0
10       0     0 DROP       0    --  eth1   *       192.168.0.0/16       0.0.0.0/0
11       0     0 DROP       0    --  *      *       224.0.0.0/8          0.0.0.0/0
12       0     0 DROP       0    --  *      *       0.0.0.0/0            224.0.0.0/8
13       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:31337
14       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:31337
15       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpts:12345:12346
16       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpts:12345:12346
17       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:1524
18       0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:27665
19       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:27444
20       0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:31335
21       0     0 DROP       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpts:33435:33525
22       0     0 DROP       udp  --  eth1   *       0.0.0.0/0            0.0.0.0/0           udp dpts:33435:33525
23      43  1720 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x04 limit: avg 1/sec burst 5
24   23561   15M ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
25       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 0
26       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3
27       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 5
28       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8
29       0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11
30      11   528 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:21
31       0     0 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:23
32      31  1488 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:25
33     131  6288 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:80
34      59  2832 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:110
35      10   480 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:443
36       0     0 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:3389
37       0     0 ACCEPT     tcp  --  eth2   *       192.168.0.0/24       0.0.0.0/0           tcp dpt:8080
38       0     0 ACCEPT     tcp  --  eth0   eth2    0.0.0.0/0            0.0.0.0/0           tcp dpt:3389
39       0     0 ACCEPT     tcp  --  eth0   eth2    0.0.0.0/0            0.0.0.0/0           tcp dpt:35106
40       0     0 ACCEPT     tcp  --  eth0   eth2    0.0.0.0/0            0.0.0.0/0           tcp dpt:35134
41       0     0 ACCEPT     tcp  --  eth0   eth2    0.0.0.0/0            0.0.0.0/0           tcp dpt:35135
42       0     0 ACCEPT     tcp  --  eth0   eth2    0.0.0.0/0            0.0.0.0/0           tcp dpt:35136
43     394 20296 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 2206 packets, 572K bytes)
num   pkts bytes target     prot opt in     out     source               destination
1       14  1638 ACCEPT     0    --  *      lo      0.0.0.0/0            0.0.0.0/0

iptables -t nat -nvL --line-numbers
Chain PREROUTING (policy ACCEPT 2477 packets, 277K bytes)
num   pkts bytes target     prot opt in     out     source               destination
1       12   576 DNAT       tcp  --  *      *       0.0.0.0/0            200.172.237.160     tcp dpt:3389 to:192.168.0.253

Chain POSTROUTING (policy ACCEPT 98 packets, 7867 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 MASQUERADE  0    --  *      eth0    192.168.0.0/24       0.0.0.0/0
2      260 12624 MASQUERADE  0    --  *      eth1    192.168.0.0/24       0.0.0.0/0

Chain OUTPUT (policy ACCEPT 98 packets, 7867 bytes)
num   pkts bytes target     prot opt in     out     source               destination


Att
Gustavo



2008/6/4 Anderson Silva <abnerdoom@gmail.com>:
Gustavo,
se a regra "ip rule add from 192.168.0.253 table embratel" está funcionando, então a maior parte do iproute também está funcionando, o problema deve ser na marcação dos pacotes ou na regra que direciona um pacote marcado para uma dada conexão.

O script que eu te enviei não estava completo... Depois eu enviei um email com um adendo ao script, você colocou as regras que eu te passei no script?

Seguem as regras:
$IPT -t mangle -A PREROUTING -i $LAN_IF -j TO_MARK
$IPT -t mangle -A OUTPUT -j TO_MARK

Para identificar o problema verifique se os pacotes estão sendo marcados com "iptables -t mangle -nvL" e olhe se o contador de pacotes da regra "--sport 3389 -j MARK --set-mark" aumentaram, verifique também a regra no iproute que direciona os pacotes marcados para uma dada conexão com o comando "ip rule show" e verifique a presença de uma linha como "from all fwmark 0xZZ lookup embratel", onde ZZ é um número hexadecimal.

mande por email os seguintes comandos (e altere os ips, para não se comprometer, caso haja ips publicos)
ip rule show
ip route show
ip route show table velox
ip route show table embratel

iptables -t mangle -nvL --line-numbers
iptables -t filter -nvL --line-numbers
iptables -t nat -nvL --line-numbers


2008/6/4 gunix <gustavo.grupos@gmail.com>:

AMigos,

ainda nada, estas mesmas regras no firewall eu ja tinha.
A unica coisa que consigo é se eu adocopnar a regra.

ip rule add from 192.168.0.253 table embratel

Porem todo trafego da maquinas passa pelo dedicado, entao se algum engraçadinho tentar baixar algo vai pelo dedicado e prejudicam os funcionarios que trabalham remoto.

Att
Gustavo

2008/6/3 Fernando Yamada <suporte2@viaip.com.br>:

tentou?

(1)
iptables -t mangle -A PREROUTING -p tcp -s <ip do windows> --sport 3389 -j MARK --set-mark 3389
ip rule add fwmark 3389 table velox
ip route add default via <gateway do velox> table velox


(2)
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to <ip do windows>
iptables -t nat -A POSTROUTING -p tcp -o <interface lan> -p tcp --dport 3389 -d <ip do windows> -j MASQUERADE
--
Fernando Yamada
Via IP Soluções para Internet Ltda
Fone: +55 48 2106-6161

e-mail: suporte2@viaip.com.br
MSN: suporte2@viaip.com.br
Skype: suporte2viaip


Quoting gunix <gustavo.grupos@gmail.com>:

ola amigos,

agradeço a ajuda, porem esta quase no fim.
A ajuda do nosso amigo anderson silva me deu esta funcionando bem.
Externamento consigo acessar meu firewall de ambas as interfaces.

A unica coisa que nao consigo é acessar meu server windows que esta
respondendo a porta 3389.
Tentei e abusei do MARK, mas mesmo assim nao vai.

E mais uma vez... se eu excluir a rota default funciona bem.

Consigo colocar uma regra na rota pela origem juntamento com laguma função
de porta?

ex: o que vier de 192.168.0.x porta 3389 ir para o link embratel?

Att
Gustavo

O unico problema que t otendo agora é o seguinte

2008/6/2 Anderson Silva <abnerdoom@gmail.com>:

Olá Gustavo,

tenho algo parecido funcionando, mas não documentei nada assim, não tenho
certeza dos passos necessários para alcançar o funcionamento, assim posso te
ajudar e quando você chegar na solução poste na lista...

- primeiramente instale o pacote iproute
- configure o iproute
Adicione duas linhas no seu arquivo /etc/iproute/rt_tables
101     velox
102     embratel

-faça um script, que tanto pode ser acionado pelo seu script de firewall,
quanto pode ser colocado dentro do script de firewall:
#########################################################################
#!/bin/bash

IPT="/sbin/iptables"
IP="/bin/ip"


WAN1_NAME="velox"
WAN1_IF="ethX"
WAN1_IP="100.100.100.2"
WAN1_GW="100.100.100.1"
WAN1_NET="100.100.100.0/24"
WAN1_MARK=101
WAN1_WEIGHT=8

WAN2_NAME="embratel"
WAN2_IF="ethY"
WAN2_IP="200.200.200.2"
WAN2_GW="200.200.200.1"
WAN2_NET="200.200.200.0/24"
WAN2_MARK=102
WAN2_WEIGHT=4

# Local Interface Information
LAN_IF="ethZ"
LAN_IP="192.168.0.254"
LAN_NET="192.168.0.0/24"
LAN_BCAST="192.168.0.255"

# Localhost Interface
LO_IF="lo"
LO_IP="127.0.0.1"
LO_NET="127.0.0.0/8"

# This target allows packets to be marked in the mangle table
/sbin/modprobe ipt_mark
/sbin/modprobe ipt_MARK

# This target affects the TCP MSS
/sbin/modprobe ipt_tcpmss

# This enables source validation by reversed path according to RFC1812.
# In other words, did the response packet originate from the same interface
# through which the source packet was sent?  It's recommended for
single-homed
# systems and routers on stub networks.  Since those are the configurations
# this firewall is designed to support, I turn it on by default.
# Turn it off if you use multiple NICs connected to the same network.
if [ "$SYSCTL" = "" ]
then
   echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter
else
   $SYSCTL net.ipv4.conf.all.rp_filter="0"
fi

# This option can be used to accept or refuse source routed
# packets.  It is usually on by default, but is generally
# considered a security risk.  This option turns it off.
if [ "$SYSCTL" = "" ]
then
   echo "1" > /proc/sys/net/ipv4/conf/all/accept_source_route
else
   $SYSCTL net.ipv4.conf.all.accept_source_route="1"
fi

# However, we'll ensure the secure_redirects option is on instead.
# This option accepts only from gateways in the default gateways list.
if [ "$SYSCTL" = "" ]
then
   echo "0" > /proc/sys/net/ipv4/conf/all/secure_redirects
else
   $SYSCTL net.ipv4.conf.all.secure_redirects="0"
fi

$IPT -t mangle -N MARK_VELOX
$IPT -t mangle -A MARK_VELOX -j MARK --set-mark $WAN1_MARK
$IPT -t mangle -A MARK_VELOX -j ACCEPT

$IPT -t mangle -N MARK_EMBRATEL
$IPT -t mangle -A MARK_EMBRATEL -j MARK --set-mark $WAN2_MARK
$IPT -t mangle -A MARK_EMBRATEL -j ACCEPT

$IPT -t mangle -N TO_MARK
$IPT -t mangle -A TO_MARK -p tcp --sport 3389 -j MARK_EMBRATEL
$IPT -t mangle -A TO_MARK -j MARK_VELOX

# Apaga tabelas de roteamento
$IP route flush table velox
$IP route flush table embratel

# Regras do iproute para direcionar marcas para as tabelas de roteamento
$IP rule add fwmark $WAN1_MARK table velox
$IP rule add fwmark $WAN2_MARK table embratel

$IP rule add from $WAN1_IP table velox
$IP rule add from $WAN2_IP table embratel

# Copia rotas da tabela principal para as outras tabelas de roteamento
$IP route show | grep -v ^default | while read rota; do
       $IP route add table velox $rota
       $IP route add table embratel $rota
done

# Definindo rota default de cada tabela de roteamento
# Tabela WAN1
$IP route add default via $WAN1_GW dev $WAN1_IF table velox

# Tabela WAN2
$IP route add default via $WAN2_GW dev $WAN2_IF table embratel

# Tabela default
$IP route add default via $WAN1_GW dev $WAN1_IF

# LIMPANDO CACHE
echo "Limpando cache de rotas."
ip route flush cache
########################################################################






2008/6/2 gunix <gustavo.grupos@gmail.com>:

Tenho o CENARIO

CLIENTE ACESSANDO (3389)
               |
               |
  ROTEADOR                         VELOX
           |                                      |
           |                                      |
           ------------SERVIDOR----------
                           LINUX DEFAULT VELOX

                               |
                               |
                         SWITCH
                               |
                               |
               SERVER RESPONDENDO 3389
            SAIDA DA INTERNET PELO VELOX

O cliente faz a requisicao do 3389 no ip fixo.
Este mesmo chega até o roteador, e do roteador no servidor firewall.
Porem no firewall minha rota padrao onde saem todas as maquinas é o velox.
Se eu deixar desta forma o servidor nao consegue responder.
TEnho umas regras DNAT nata que aponta a conexao para o server.
Porem se eu colocar a conexao default o Embratel e deixar o Velox de lado,
ai funciona normalmente.

O que pode ser?

Att
Gustavo


2008/6/2 Junior Polegato - Linux <linux@juniorpolegato.com.br>:

gunix escreveu:

Na verdade meu link entra no meu firewall, por isso nao ta fazendo...
Tenho que fazer estar rotas nao mao para funcionar.
Porem vi uns assuntos que é possivel eu direcionar somente porta. Ex:
Tudo da rede na porta 3389 passa pelo link. o que nao for passa  pelo velox.

2008/6/2 Junior Polegato - Linux <linux@juniorpolegato.com.br <mailto:
linux@juniorpolegato.com.br>>:

  gunix escreveu:

      alguem poderia me dizer como faço para criar um roteamento
      pela origem?
      Porem gostaria de fazer o seguinte.
      Tenho 3 placas de rede:
      eth0 - LAN
      eth1 - Velox
      eth2 - Embratel Dedicado
      Tudo que sai da rede gostaria que sai-se pelo Velox.
      E tudo que sai da porta 3389 Gostaria que sai-se pelo Embratel.
      Na verdade as pessoas vão se conectar pela porta 3389 no meu
      server pelo embratel. E deve retornar pelo mesmo link.
      O Velox estando default da problema.
      Algeum pode me ajudar?


       Não estou muito certo, mas pelo visto vai ter um servidor
  respondendo na porta 3389, é isso? Se sim, então basta
  "anunciá-lo" pelo link da Embratel e a tabela de roteamento cuida
  do resto. Já tentou fazer ou monitorar isso?
       Se quer a entrada pelo link da Velox e saído pelo da
  Embratel, acho complicado, creio que não tenha um jeito simples.


Olá,

    Primeira pergunta não respondida: vai ter um servidor respondendo na
porta 3389?

    Se a resposta for sim, então você precisa acessá-lo através o link
da Embratel, aí todo o fluxo entre esse servidor e o cliente trafega pelo
link da Embratel "naturalmente".

    Se a resposta for não, você está querendo acessar um servidor, isto
é, você é o cliente, é só colocar uma rota estática para este servidor.

    Descreva melhor seu cenário.

[]'s
       Junior Polegato









--
To UNSUBSCRIBE, email to debian-user-portuguese-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org





Reply to: