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

problem z policy routing



Witam wiem ze ten temat przewinol sie wiele razy przez forum ale jakosnie znalazlem tam odpowiedzi na swoj problem.
A wiec mam 2 lacza internetoe eth1 i eth2 Otot skrypt ktory odpala mi interfejsy:
 
#!/bin/bash
echo "Ładuje zmienne"
IF0=eth0
IF1=eth1
IF2=eth2
IP1=83.17.36.50
IP2=83.17.36.130
P1=83.17.36.49
P2=83.17.36.129
P0_NET=192.168.0.0/24
P1_NET=83.17.36.48/29
P2_NET=83.17.36.128/29
 
ip route add $P1_NET dev $IF1 src $IP1 table N1
#ip route add default via $P1 table N1
ip route add $P2_NET dev $IF2 src $IP2 table N2
#ip route add default via $P2 table N2
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
ip route add default via $P1
ip rule add from $IP2 table N2
ip rule add from $IP1 table N1
ip route add $P0_NET dev $IF0 table N1
ip route add $P2_NET dev $IF2 table N1
ip route add 127.0.0.0/8 dev lo   table N1
ip route add $P0_NET dev $IF0 table N2
ip route add $P1_NET dev $IF1 table N2
ip route add 127.0.0.0/8 dev lo   table N2
ip route add default via $P1 table N1
ip route add default via $P2 table N2
ip route flush cache
No i teoretycznie dziala ale problem powsaje gdy chce kierowac ruchem
w tym celu zgodnie z dokumentacja zrobilem nowa tabele w iproute2 i nazwie p2p do ktorej bedzie kierowany ruch p2p.
Oto regolki:
 
ip rule add fwmark 1 table p2p
ip route add default via 83.17.36.130 dev eth2 table p2p
iptables -A PREROUTING -i eth0 -t mangle -p tcp -m ipp2p --ipp2p -j MARK --set-mark 1
na manglu pakiety sa ladnie liczone ale nic nie wpada na 2 lacze gdzie moze byc problem W jadro mam wszystko wkapilowane :
 
  │ │                [*]   IP: advanced router                                                │ │
  │ │                [*]     IP: policy routing                                               │ │
  │ │                [*]       IP: use netfilter MARK value as routing key    
 
 
Prosz o pomoc

Reply to: