Páginas

segunda-feira, 5 de julho de 2010

FreeBSD: Script - Balanceamento de links

#!/bin/sh
# Variaveis
fw="/sbin/ipfw"
ext_if1="ste0"
ext_if2="ste1"
int_if="vr0"
rede_local="192.168.1.0/24"

# Limpa Regras
$fw -f flush

setfib 1 route add default 192.168.254.254

$fw add prob 0.5 setfib 1 all from $rede_local to any keep-state

$fw add nat 1 all from $rede_local to any out via $ext_if1
$fw add nat 1 all from any to me recv $ext_if1
$fw nat 1 config if ste0
$fw add nat 2 all from $rede_local to any out via $ext_if2
$fw add nat 2 all from any to me recv $ext_if2
$fw nat 2 config if ste1

Nenhum comentário:

Postar um comentário