[Ubuntu-BR] iproute2

Armando Barsotini Neto a.barsotini em gmail.com
Sexta Abril 16 22:22:35 UTC 2010


Eu utilizo da seguinte forma:  (Considerando o FIREWALL desativado)

[root em armando iproute2]# cat rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
#Alteracao
226     ded1
227     rad1

**** Essas 2 últimas linhas devem começar com um valor *inferior* a 253

Crio um arquivo de script com o conteúdo:

[root em armando ~]# cat edata_rotas

#### LINK 01 DEDICADO

ip route add 187.111.111.111/29 dev eth2 table ded1    **** AQUI É O IP DA
REDE
ip route add default via 187.111.111.222 table ded1         **** AQUI É O IP
DO GW
ip rule add from 187.111.111.200 table ded1                  **** AQUI É O
IP VÁLIDO
# ROTA PADRAO DEDICADO
ip route add default scope global nexthop via 187.111.111.222 dev eth2
**** IP DO GW


#### LINK 02 RADIO

ip route add 189.222.222.0/24 dev eth1 table rad1    *REDE
ip route add default via 189.222.222.1 table rad1     * GW
ip rule add from 189.222.222.15 table rad1             *IP Válido


#### LIMPA CACHE DAS TABELAS
ip route flush cache


*** PRONTO **** é pra pingar nos 2 LINKS !!!

Agora no Firewall permita apenas o ICMP entrante para o LINK desejado.


Att,

Armando Barsotini Neto

Linux User # 503670
Ubuntu User # 30175


Att,

Armando Barsotini Neto

Linux User # 503670
Ubuntu User # 30175


Em 16 de abril de 2010 19:15, Marcio Verderio Tahan
<marcio em vtnet.com.br>escreveu:

> A tabela está:
> #
> # reserved values
> #
> 255     local
> 254     main
> 253     default
> 0       unspec
> 20 speedy
>
> E meu roteamento atual está:
> 189.108.9.xxx/29 dev eth1  proto kernel  scope link  src 189.108.9.xxx
> 192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.1
> 201.0.xxx.0/24 dev eth2  proto kernel  scope link  src 201.0.xxx.245
> default via 189.108.9.xxx dev eth1  metric 100
>
>
> Obrigado pela ajuda. :)
>
>
> 2010/4/16 Armando Barsotini Neto <a.barsotini em gmail.com>
>
> > Olá...
> >
> > Como está sua tabela /etc/iproute2/rt_tables  ????
> >
> > Att,
> >
> > Armando Barsotini Neto
> >
> > Linux User # 503670
> > Ubuntu User # 30175
> >
> >
> > Em 16 de abril de 2010 19:06, Marcio Verderio Tahan
> > <marcio em vtnet.com.br>escreveu:
> >
> > > *
> > > Ola pessoal,*
> > > *
> > > *
> > > *Estou com uma dificuldade absurda de fazer o iproute funcionar no
> ubuntu
> > > 9.10.*
> > > *Alguem poderia me dar uma forcinha?? rs.*
> > > *Primeiramente vejam meus arquivos de configuracao:*
> > >
> > > =====================
> > > *Tenho dos links, o primeiro quero deixar como default, o segundo
> SPEEDY
> > > quero apenas fazer o fluxo icmp passar por ele, como teste, claro.*
> > > *
> > > *
> > > *
> > > *
> > > *## Quero apenas como teste, pingar o ip 200.212.96.1 pela minha
> > interface
> > > eth2*
> > >
> > > *#marquei pacotes como 1 (inibi o ip com xx)*
> > > iptables -t mangle -A INPUT -p icmp -s 200.212.xx.1 -j MARK --set-mark
> 1
> > > iptables -t mangle -A OUTPUT -p icmp -d 200.212.xx.1 -j MARK --set-mark
> 1
> > >
> > > *# Informo que a marcacao 1 e para a tabela speedy*
> > > ip rule add fwmark 1 table speedy prio 20
> > >
> > > #* Agora crio o roteamento (inibi o ip com xxx por seguranca)*
> > > ip route add default via 201.0.xxx.1 src 201.0.xxx.245 table speedy
> > >
> > > ip route flush cache
> > >
> > > ===============================================================
> > >
> > > *Vejam que ao pingar para o IP 200.212.xx.1 ele nao da resposta:*
> > >
> > > root em mr-frw:/home/marcio# ping 200.212.xx.1
> > > PING 200.212.xx.1 (200.212.xx.1) 56(84) bytes of data.
> > > ^C
> > > --- 200.212.xx.1 ping statistics ---
> > > 363 packets transmitted, 0 received, 100% packet loss, time 364896ms
> > >
> > >
> > > *Agora se pingo o ip do UOL, tudo vai bem:*
> > > PING www.uol.com.br (200.221.2.45) 56(84) bytes of data.
> > > 64 bytes from home.uol.com.br (200.221.2.45): icmp_seq=1 ttl=59
> > time=14.9
> > > ms
> > > 64 bytes from home.uol.com.br (200.221.2.45): icmp_seq=2 ttl=59
> > time=11.9
> > > ms
> > > 64 bytes from home.uol.com.br (200.221.2.45): icmp_seq=3 ttl=59
> time=113
> > > ms
> > > 64 bytes from home.uol.com.br (200.221.2.45): icmp_seq=4 ttl=59
> time=412
> > > ms
> > > ^C
> > > --- www.uol.com.br ping statistics ---
> > > 4 packets transmitted, 4 received, 0% packet loss, time 3004ms
> > > rtt min/avg/max/mdev = 11.944/138.267/412.574/163.566 ms
> > >
> > > ==============================================================
> > >
> > > *Bom, e isso. Eu realmente nao sei como fazer. Estou achando que ao
> sair
> > > ele
> > > sai pela rota certa, mas quando volta, esta voltando pelo outro
> > > dispositivo,
> > > sei la..*
> > > *Alguem poderia me dar uma luz se ja passaram por isso??*
> > > *
> > > *
> > > *Abracao a todos.*
> > > --
> > > Mais sobre o Ubuntu em português: http://www.ubuntu-br.org/comece
> > >
> > > Lista de discussão Ubuntu Brasil
> > > Histórico, descadastramento e outras opções:
> > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-br
> > >
> > --
> > Mais sobre o Ubuntu em português: http://www.ubuntu-br.org/comece
> >
> > Lista de discussão Ubuntu Brasil
> > Histórico, descadastramento e outras opções:
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-br
> >
> --
> Mais sobre o Ubuntu em português: http://www.ubuntu-br.org/comece
>
> Lista de discussão Ubuntu Brasil
> Histórico, descadastramento e outras opções:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-br
>



More information about the ubuntu-br mailing list