Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Próxima revisión
Revisión previa
network_load_balancing [2024/05/28 16:13] – creado - editor externo 127.0.0.1network_load_balancing [2026/05/28 15:12] (actual) – [Referencias] kasandra
Línea 28: Línea 28:
  
 FIN FIN
 +
 +Las tablas toca definirlas 
 +/etc/iproute2/rt_tables and add custom routing tables for each ISP:
 +text
 +
 +10  etb
 +20  tigo
 +
  
 ============================================================= =============================================================
  
 <code> <code>
-#!/bin/sh# by skina##IP address of external interfaces. This is not the gateway address.IP1=192.168.69.10IP2=`ifconfig ppp0 | head -n 2 | tail -n 1 | cut -d: -f 2| awk '{print $1}'`#Gateway IP addresses. This is the first (hop) gateway, could be your router IP#address if it has been configured as the gatewayGW1=192.168.69.1GW2=10.64.64.64NET1="192.168.69.0/24"NET2="10.64.64.64/32"DEV1=eth0DEV2=ppp0# Relative weights of routes. Keep this to a low integer value. I am using 4# for TATA connection because it is 4 times fasterW1=2W2=1# Broadband providers name; use your own names here.NAME1=etbNAME2=tigo################### --------- ahora si hagaleroute del -net defaultecho "ip route add $NET1 dev $DEV1 src $IP1 table $NAME1"ip route add $NET1 dev $DEV1 src $IP1 table $NAME1echo "ip route add default via $GW1 table $NAME1"ip route add default via $GW1 table $NAME1echo "ip route add $NET2 dev $DEV2 src $IP2 table $NAME2"ip route add $NET2 dev $DEV2 src $IP2 table $NAME2echo "ip route add default via $GW2 table $NAME2"ip route add default via $GW2 table $NAME2echo "ip rule add from $IP1 table $NAME1"ip rule add from $IP1 table $NAME1echo "ip rule add from $IP2 table $NAME2"ip rule add from $IP2 table $NAME2echo "ip route add default scope global nexthop via $GW1 dev $DEV1 weight $W2 nexthop via $GW2 dev $DEV2 weight $W2"ip route add default scope global nexthop via $GW1 dev $DEV1 weight $W1 nexthop via $GW2 dev $DEV2 weight $W2 
-</code> 
  
-  
  
-==============================================================+#!/bin/sh 
 +# by skina 
 +#
  
-15-Marzo-2006 J.E.Gomez v1.0 Primera version+DEV1=eth0 
 +DEV2=ppp0
  
 +#IP address of external interfaces. This is not the gateway address.
 +IP1=192.168.69.10
 +IP2=`ifconfig $DEV2  | head -n 2 | tail -n 1 | cut -d: -f 2| awk '{print $2}'`
  
-----+#Gateway IP addresses. This is the first (hop) gateway, could be your router IP 
 +#address if it has been configured as the gateway 
 +GW1=192.168.69.1 
 +GW2=10.64.64.64
  
-__**Advertencia**__+NET1="192.168.69.0/24" 
 +NET2="10.64.64.64/32"
  
-Este documento es privado y es de u so exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra la ley de derechos de autor y de propiedad intelectual, y será motivo de una acción legal. 
  
 +# Relative weights of routes. Keep this to a low integer value. I am using 4
 +# for TATA connection because it is 4 times faster
 +W1=2
 +W2=1
 +
 +
 +# Broadband providers name; use your own names here.
 +NAME1=etb
 +NAME2=tigo
 +
 +################### --------- ahora si hagale
 +
 +route del -net default
 +
 +echo "ip route add $NET1 dev $DEV1 src $IP1 table $NAME1"
 +ip route add $NET1 dev $DEV1 src $IP1 table $NAME1
 +
 +echo "ip route add default via $GW1 table $NAME1"
 +ip route add default via $GW1 table $NAME1
 +
 +echo "ip route add $NET2 dev $DEV2 src $IP2 table $NAME2"
 +ip route add $NET2 dev $DEV2 src $IP2 table $NAME2
 +
 +echo "ip route add default via $GW2 table $NAME2"
 +ip route add default via $GW2 table $NAME2
 +
 +echo "ip rule add from $IP1 table $NAME1"
 +ip rule add from $IP1 table $NAME1
 +
 +echo "ip rule add from $IP2 table $NAME2"
 +ip rule add from $IP2 table $NAME2
 +
 +echo "ip route add default scope global nexthop via $GW1 dev $DEV1 weight $W2 nexthop via $GW2 dev $DEV2 weight $W2"
 +ip route add default scope global nexthop via $GW1 dev $DEV1 weight $W1 nexthop via $GW2 dev $DEV2 weight $W2
 + 
 +
 +</code>
 +
 + 
 +
 +==============================================================
 +
 +¿
  
 ---- ----
  
Volver arriba