From: "Nataniel Klug" Date: Tue, 18 Oct 2005 18:45:07 +0000 Subject: [LARTC] Two differente networks at the same ethernet pci adapter Message-Id: <001d01c5d414$0fe382d0$57001eac@NATANIEL> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org Hello all, I need to put an IP alias to the same ethernet card, like this: eth0 - IP1/MASK1/BROADCAST1 eth0:1 - IP2/MASK2/BROADCAST2 In this box I will have another card that conects to a LAN netowork. I need this two alias in eth0 becouse I have two routes do take, but it seens to do not work. This is the script I am using (this scripts works fine when I have two ethernet cards like eth0 and eth1 for backbone and eth2 for LAN): ---- SCRIPT BEGINING /usr/loca/firewall/loadbalance ---- #!/bin/sh #------------------------- # Configuracao de redirecionamento de portas para os links # Balanceamento de carga entre pontos de rede # ++++++++++++++++++++++++ # Script criado por NATANIEL KLUG #------------------------- # #---- # Variaveis de sistema #---- IPTABLES="/usr/local/sbin/iptables" IP="/sbin/ip" # #---- # ENTRADA DE LINKS #---- IF1='eth0' IF2='eth0' # #---- # Declara as redes #---- P1_NET2.30.0.0/24' P2_NET='10.1.1.0/24' # #---- # Declara IPs #---- IP1='172.30.0.55' IP2='10.1.1.10' # #---- # Declara gateway das conexoes #---- P1='172.30.0.1' P2='10.1.1.1' # #---- # Mascara as redes e marca os pacotes #---- $IPTABLES -t nat -A POSTROUTING -o $IF1 -j MASQUERADE $IPTABLES -t nat -A POSTROUTING -o $IF2 -j MASQUERADE # #---- # Declaracao de rotas padrao para os links #---- $IP route add $P1_NET dev $IF1 src $IP1 table T1 $IP route add default via $P1 table T1 $IP route add $P2_NET dev $IF2 src $IP2 table T2 $IP route add default via $P1 table T2 # $IP route add $P1_NET dev $IF1 src $IP1 $IP route add $P2_NET dev $IF2 src $IP2 # $IP route add default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P2 dev $IF2 weight 1 # $IP rule add from $IP1 table T1 $IP rule add from $IP2 table T2 # #---- # Atualiza tabela de cache #---- $IP route flush cache ---- END OS SCRIPT --- What can I do (if there is something) for this to work? Att, Nataniel Klug _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc