Witam,
Wiem ze juz bylo wiele razy, ale jakos mi to nie wychodzi, i nie wiem
dlaczego ;/
Wiec moze od poczatku.
eth0 - polpak
eth1 - lan
eth2 - lan
eth3 - dsl
ip route add 2.2.2.152/29 dev eth3 proto static table T2
ip route add default via 2.2.2.153 proto static table T2
ip rule add fwmark 65000 table T2 prio 1
ip rule add from 2.2.2.152/29 table T2 prio 2
ip route flush cache
router:~# ip ru
0: from all lookup local
1: from all fwmark 65000 lookup T2
2: from 2.2.2.152/29 lookup T2
32766: from all lookup main
32767: from all lookup default
router:~# ip ro
2.2.2.152/29 dev eth3 proto kernel scope link src 2.2.2.154
1.1.1.0/26 dev eth0 proto kernel scope link src 1.1.1.2
10.0.4.0/24 dev eth1 proto kernel scope link src 10.0.4.254
10.0.20.0/24 dev eth1 proto kernel scope link src 10.0.20.254
10.0.5.0/24 dev eth1 proto kernel scope link src 10.0.5.254
10.0.6.0/24 dev eth2 proto kernel scope link src 10.0.6.254
10.0.7.0/24 dev eth2 proto kernel scope link src 10.0.7.254
10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.254
10.0.16.0/24 dev eth2 proto kernel scope link src 10.0.16.254
10.0.1.0/24 dev eth1 proto kernel scope link src 10.0.1.254
10.0.17.0/24 dev eth1 proto kernel scope link src 10.0.17.254
10.0.2.0/24 dev eth1 proto kernel scope link src 10.0.2.254
10.2.2.0/24 dev eth1 proto kernel scope link src 10.2.2.254
10.0.18.0/24 dev eth1 proto kernel scope link src 10.0.18.254
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.1
10.0.3.0/24 dev eth1 proto kernel scope link src 10.0.3.254
10.0.19.0/24 dev eth1 proto kernel scope link src 10.0.19.254
10.0.12.0/24 dev eth2 proto kernel scope link src 10.0.12.254
10.0.13.0/24 dev eth1 proto kernel scope link src 10.0.13.254
10.0.14.0/24 dev eth1 proto kernel scope link src 10.0.14.254
10.0.15.0/24 dev eth1 proto kernel scope link src 10.0.15.254
10.0.8.0/24 dev eth2 proto kernel scope link src 10.0.8.254
10.10.10.0/24 dev eth0 proto kernel scope link src 10.10.10.254
10.1.1.0/24 dev eth2 proto kernel scope link src 10.1.1.254
10.0.9.0/24 dev eth1 proto kernel scope link src 10.0.9.254
10.0.10.0/24 dev eth1 proto kernel scope link src 10.0.10.254
10.0.11.0/24 dev eth2 proto kernel scope link src 10.0.11.254
127.0.0.0/8 dev lo scope link
default via 1.1.1.1 dev eth0 metric 1
router:~# traceroute -n -s 1.1.1.2 nazwa.pl
traceroute to nazwa.pl (85.128.128.36) from 1.1.1.2, 30 hops max,
38 byte packets
1 1.1.1.1 7.402 ms 10.954 ms 5.866 ms
router:~# traceroute -n -s 2.2.2.154 nazwa.pl
traceroute to nazwa.pl (85.128.128.36) from 2.2.2.154, 30 hops max,
38 byte packets
1 2.2.2.153 0.404 ms 0.208 ms 0.419 ms
Teoretycznie wyjscie po danym laczu dziala z pozycji serwera, ale
niestety nie z lana.
Gdy dla testu dodam:
iptables -t mangle -A PREROUTING -d wp.pl -j MARK --set-mark 65000
iptables -vnl.. pokazuje ze pakiety sie lapia na marka, jednak z
komputera w lanie traceroute i wszystko inne idzie po domyslnym laczu a
nie po DSLu.
Siedze nad tym juz kilka dni i brak mi koncepcji.
Kilka rzeczy z konfiguracji.
Kernel 2.4.32-grsec
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_FWMARK=y
Reguly dla sieci lokalnej:
iptables -t nat -A POSTROUTING -s 10.0.3.1/32 -j SNAT --to-source
1.1.1.2
iptables -t nat -A PREROUTING -p tcp -s 10.0.3.1 --dport 80 -j DNAT
--to 1.1.1.2:8081
iptables -t mangle -A LIMITS -s 10.0.3.1 -j MARK --set-mark 523
iptables -t mangle -A LIMITS -d 10.0.3.1 -j MARK --set-mark 523
iptables -t mangle -p tcp -A OUTPUT -d 10.0.3.1 --sport 8081 -j MARK
--set-mark 523
iptables -t filter -I FORWARD -p tcp -s 10.0.3.1 -m connlimit
--connlimit-above 200 -j REJECT
iptables -t filter -I FORWARD -p tcp -d 10.0.3.1 -m limit --limit 150/s
-m ipp2p --ipp2p -j ACCEPT
iptables -t filter -I FORWARD -p tcp -s 10.0.3.1 -m limit --limit 150/s
-m ipp2p --ipp2p -j ACCEPT
tc class add dev eth0 parent 2:1 classid 2:523 htb rate 256.00kbit ceil
256.00kbit burst 30k prio 2 quantum 1500
tc filter add dev eth0 parent 2:0 protocol ip prio 5 handle 523 fw
flowid 2:523
tc qdisc add dev eth0 parent 2:523 handle 523:0 esfq perturb 10 hash
dst
tc class add dev imq0 parent 1:2 classid 1:523 htb rate 512.00kbit ceil
512.00kbit burst 30k prio 2 quantum 1500
tc filter add dev imq0 parent 1:0 protocol ip prio 5 handle 523 fw
flowid 1:523
tc qdisc add dev imq0 parent 1:523 handle 523:0 esfq perturb 10 hash
dst
Wiem ze jest tutaj sporo roznuch innych rzeczy, ale jak mowie, mark
lapie pakety wiec z zaznaczeniem napewno jest wszystko ok.
Ktos ma jakas koncepcje?
Bede bardzo wdzieczny za pomoc.
|