31 March 2010

port base route

 Seems not worth because some game client do auth in 80 port and do game play in other port.  huff.. I dont consider it before.. then I list sniff all packet from computers game and make ip list of game servers, and try to marking packet by destination ip. but not tested yet.
* dont forget to add table name to /etc/iproute2/rt_tables







[bof copy &;paste]-----

#!/bin/bash
# Route by port

IP="/bin/ip"
IPT="/sbin/iptables"
GREEN="eth2"
RED_A="eth0"
RED_B="eth1"
RED_B_IP="192.168.251.1"
MARKING="/sbin/iptables -t mangle -A PREROUTING -p tcp -j MARK --set-mark 0x1 --dport "

ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up

$IPT --flush
$IPT --table nat --flush
$IPT --delete-chain
$IPT --table nat --delete-chain


## --Lady Masquerade
$IPT --table nat --append POSTROUTING --out-interface $RED_A -j MASQUERADE
$IPT --table nat --append POSTROUTING --out-interface $RED_B -j MASQUERADE
$IPT --append FORWARD --in-interface $GREEN -j ACCEPT

## markin paket

#-- Y!M
$MARKING 5050

#-- Dota Nusa
$MARKING 6112

#-- YulGang
$MARKING 1900

#-- RF Celestial
$MARKING 6666
$MARKING 10001
$MARKING 27780

#-- CROSFIRE
$MARKING 16666

#-- LUNA
$MARKING 15000

#-- PB
$MARKING 39190

## add marking ke table,
$IP rule add fwmark 0x1 table game


## tambah route game
route add default gw 192.168.250.1
$IP route add default via $RED_B_IP dev $RED_B table game

echo "1" > /proc/sys/net/ipv4/ip_forward