3 internet connexions - Problem with my script

Linux Advanced Routing and Traffic Control

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

 



Hi,

I have a problem with my script.

I have a debian with a kernel 2.6.8 patched with patch-2.6.8-ja1.diff of nano.txt site.

I have 3 internet connections :
    - eth1 :
          - ip : 192.168.8.75
          - gw : 192.168.8.73
    - eth2 :
          - ip : 192.168.1.200
          - gw : 192.168.1.2
    - eth3 :
          - ip : 192.168.2.200
          - gw : 192.168.2.1

    and my eth0 for local network (ip : 192.168.212.235)

My Load_Balancing.sh script :
IFI="eth0"
IPI="192.168.212.235"
NMI="24"

IFE2="eth1"
IPE2="196.200.8.75"
NWE2="196.200.8.0"
NME2="29"
BRD2="196.200.8.255"
GWE2="196.200.8.73"

IFE1="eth2"
IPE1="192.168.1.200"
NWE1="192.168.1.0"
NME1="24"
BRD1="192.168.1.255"
GWE1="192.168.1.2"

IFE3="eth3"
IPE3="192.168.2.200"
NWE3="192.168.2.0"
NME3="24"
BRD3="192.168.2.255"
GWE3="192.168.2.1"

# Configuration de l'interface de Loopback
ip link set lo up
ip addr add 127.0.0.1/8 brd + dev lo

# Configuration de l'interface interne
ip link set $IFI up
ip addr add $IPI/$NMI brd + dev $IFI
ip rule add prio 50 table main
ip route del default table main

# Configuration de la premiere connexion Internet
ip link set $IFE1 up
ip addr flush dev $IFE1
ip addr add $IPE1/$NME1 brd $BRD1 dev $IFE1

# Configuration de la deuxieme connexion Internet
ip link set $IFE2 up
ip addr flush dev $IFE2
ip addr add $IPE2/$NME2 brd $BRD2 dev $IFE2

# Configuration de la troisieme connexion Internet
ip link set $IFE3 up
ip addr flush dev $IFE3
ip addr add $IPE3/$NME3 brd $BRD3 dev $IFE3

ip rule add prio 222 table 222
ip route add default scope global \
nexthop via $GWE1 dev $IFE1 weight 1 \
nexthop via $GWE2 dev $IFE2 weight 4 \
nexthop via $GWE3 dev $IFE3 weight 1

ip rule add prio 201 from $NWE1/$NME1 table 201
ip route add default via $GWE1 dev $IFE1 src $IPE1 proto static table 201
ip route append prohibit default table 201 metric 1 proto static

ip rule add prio 202 from $NWE2/$NME2 table 202
ip route add default via $GWE2 dev $IFE2 src $IPE2 proto static table 202
ip route append prohibit default table 202 metric 1 proto static

ip rule add prio 203 from $NWE3/$NME3 table 203
ip route add default via $GWE3 dev $IFE3 src $IPE3 proto static table 203
ip route append prohibit default table 203 metric 1 proto static


And my firewall.sh script for nat :

IFI="eth0"
IPI="192.168.212.235"
NWI="192.168.212.0"
NMI="24"

IFE2="eth1"
IPE2="196.200.8.75"
NWE2="196.200.8.0"
NME2="29"
BRD2="196.200.8.255"
GWE2="196.200.8.73"

IFE1="eth2"
IPE1="192.168.1.200"
NWE1="192.168.1.0"
NME1="24"
BRD1="192.168.1.255"
GWE1="192.168.1.2"

IFE3="eth3"
IPE3="192.168.2.200"
NWE3="192.168.2.0"
NME3="24"
BRD3="192.168.2.255"
GWE3="192.168.2.1"

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o $IFE1 -s $NWI/$NMI -j MASQUERADE
iptables -t nat -A POSTROUTING -o $IFE2 -s $NWI/$NMI -j MASQUERADE
iptables -t nat -A POSTROUTING -o $IFE3 -s $NWI/$NMI -j MASQUERADE

iptables -t filter -N keep_state
iptables -t filter -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A keep_state -j RETURN

iptables -t nat -N keep_state
iptables -t nat -A keep_state -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A keep_state -j RETURN

iptables -t nat -A PREROUTING -j keep_state
iptables -t nat -A POSTROUTING -j keep_state
iptables -t nat -A OUTPUT -j keep_state

iptables -t filter -A INPUT -j keep_state
iptables -t filter -A FORWARD -j keep_state
iptables -t filter -A OUTPUT -j keep_state


I have 30 pc under this gateway.

The only website used by PC is http://example.google.fr

My BIG problem is all PC use just one interface of this gateway (eth2) and I haven't load balancing between connections.

Someone can help me?

Thanks
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux