router problem

sergis@banda.lv
Sun, 19 Dec 2004 17:44:31 -0000

Hi all i have big problem,I am newbie and my english is bad,but i know you can
help solve my problem.

I have box with gentoo,I live in latvia and i have 2 ISP:
One isp gives me ip range from 62.85.71.1-62.85.71.15 (62.85.71.1 is gateway)
but there is only latvian trafik - no other countries (link is 2 mbit
Asinhronus dsl) and other isp who gives me one ip from dhcp adn there ios no
trafik limitations (link is 512kbit Asinhronus dsl).I have local net connected
to this linux box who haves ip range 10.10.10.11-10.10.10.19 gw is 10.10.10.1
on my linux box.On this linux box running (mail,dns,web,counter strike
server).On local net are more p2p programms,downloaders,e.t.c.When people from
"outside" playing on my server hi have extreme lags caused by link
owerloading
and large packet loss.But my priority is cs trafik. I need to priorize this
trafik(i know cs have many litle packets) but i need to priorize my cs
server.And i need your help.I try wondersharper but without results.

With this script i start my box now:(is this correct?)

INET_IFACE=eth0
INET_NET=62.85.71.0/28
INET_GW=62.85.71.1
INET_IP=62.85.71.10
INET_BCAST_ADRESS=62.85.71.15
INET_MASK=255.255.255.240
DSL_IFACE=eth2
DSL_NET=81.198.4.0/28
DSL_GW=81.198.4.1
DSL_IP=81.198.7.159
DSL_BCAST_ADRESS=81.198.7.255
DSL_MASK=255.255.252.0
LAN_IFACE=eth1
LAN_IP=10.10.10.0
LAN_NET=10.10.10.0/24
LAN_MASK=255.255.255.0
LAN_BCAST=10.10.10.255
INET_IP1=62.85.71.2
INET_IP2=62.85.71.3
INET_IP3=62.85.71.4
INET_IP4=62.85.71.5
INET_IP5=62.85.71.6
INET_IP6=62.85.71.7
INET_IP7=62.85.71.8
INET_IP8=62.85.71.9
INET_IP9=62.85.71.11
LAN_IP1=10.10.10.11/32
LAN_IP2=10.10.10.12/32
LAN_IP3=10.10.10.13/32
LAN_IP4=10.10.10.14/32
LAN_IP5=10.10.10.15/32
LAN_IP6=10.10.10.16/32
LAN_IP7=10.10.10.17/32
LAN_IP8=10.10.10.18/32
LAN_IP9=10.10.10.19/32
IP=ip
IPT=iptables
IR=route
IFC=ifconfig
echo "1" > /proc/sys/net/ipv4/ip_forward
$IFC eth0:1 $INET_IP1 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:2 $INET_IP2 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:3 $INET_IP3 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:4 $INET_IP4 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:5 $INET_IP5 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:6 $INET_IP6 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:7 $INET_IP7 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:8 $INET_IP8 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
$IFC eth0:9 $INET_IP9 broadcast $INET_BCAST_ADRESS netmask $INET_MASK
ip route flush table main
ip route flush table 1
ip route flush table 2
ip route add 62.85.71.0/28 dev eth0 src 62.85.71.10
ip route add 10.10.10.0/24 dev eth1 src 10.10.10.1
ip route add 81.198.4.0/28 dev eth2 src 81.198.7.159
ip route add 127.0.0.0/8 dev lo
ip route add default via 81.198.4.1
ip route add 62.85.71.0/28 dev eth0 src 62.85.71.10 table 1
ip route add 10.10.10.0/24 dev eth1 src 10.10.10.1 table 1
ip route add 81.198.4.0/23 dev eth2 src 81.198.7.159 table 1
ip route add 127.0.0.0/8 dev lo
ip route add default via 62.85.71.1 table 1
ip route add 62.85.71.0/28 dev eth0 src 62.85.71.10 table 2
ip route add 10.10.10.0/24 dev eth1 src 10.10.10.1 table 2
ip route add 81.198.4.0/28 dev eth2 src 81.198.7.159 table 2
ip route add 127.0.0.0/8 dev lo table 2
ip route add default via 81.198.4.1 table 2
ip rule add from 62.85.71.2 table 1
ip rule add from 62.85.71.3 table 1
ip rule add from 62.85.71.4 table 1
ip rule add from 62.85.71.5 table 1
ip rule add from 62.88.71.6 table 1
ip rule add from 62.85.71.7 table 1
ip rule add from 62.85.71.8 table 1
ip rule add from 62.85.71.9 table 1
ip rule add from 62.85.71.10 table 1
ip rule add from 62.85.71.11 table 1
ip rule add from 81.198.7.159 table 2
$IPT -t mangle -F
$IPT -A OUTPUT -t mangle -p udp --sport 27015  -j TOS --set-tos
Maximize-Throughput
$IPT -A OUTPUT -t mangle -p udp --dport 27015  -j TOS --set-tos
Maximize-Throughput
$IPT -t nat -F
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP1 -j SNAT --to $INET_IP1
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP2 -j SNAT --to $INET_IP2
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP3 -j SNAT --to $INET_IP3
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP4 -j SNAT --to $INET_IP4
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP5 -j SNAT --to $INET_IP5
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP6 -j SNAT --to $INET_IP6
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP7 -j SNAT --to $INET_IP7
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP8 -j SNAT --to $INET_IP8
$IPT -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP9 -j SNAT --to $INET_IP9
$IPT -t nat -A POSTROUTING -o $DSL_IFACE -j SNAT --to $DSL_IP
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
     echo 1 > $f
done
$IPT -A FORWARD -i eth1 -s ! $LAN_NET -j DROP
for LIST in `cat /etc/init.d/Scripts/data/lv_iplist`; do
ip route add to $LIST via 62.85.71.1
done
/etc/init.d/Scripts/data/lv_iplist contains data of my country i subnets
(example 81.198.4.0/23 etc)

Plz help me..





---------------------------------------------------------------------
Radical ringtones, java games, mobile phone logos, backgrounds
http://sms.BANDA.LV !
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/