All pastes #556795 Raw Edit

Something

public text v1 · immutable
·published 2007-06-10 19:18 UTC
rendered paste body

~ # ifconfig
br0       Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F0
          inet addr:192.168.5.1  Bcast:192.168.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:1927217 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1309927 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2024208275 (1.8 GiB)  TX bytes:106697476 (101.7 MiB)

br0:0     Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F0
          inet addr:169.254.255.1  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3237572 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3198720 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2189373020 (2.0 GiB)  TX bytes:2175189750 (2.0 GiB)
          Interrupt:5

eth1      Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F2
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:849 errors:0 dropped:0 overruns:0 frame:86646
          TX packets:12783 errors:308 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:77239 (75.4 KiB)  TX bytes:1279111 (1.2 MiB)
          Interrupt:4 Base address:0x1000

imq0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP RUNNING NOARP  MTU:1500  Metric:1
          RX packets:1310293 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1310293 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:30
          RX bytes:88473816 (84.3 MiB)  TX bytes:88473816 (84.3 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING MULTICAST  MTU:16436  Metric:1
          RX packets:478 errors:0 dropped:0 overruns:0 frame:0
          TX packets:478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:44182 (43.1 KiB)  TX bytes:44182 (43.1 KiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.8.0.6  P-t-P:10.8.0.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:224 errors:0 dropped:0 overruns:0 frame:0
          TX packets:302 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:24200 (23.6 KiB)  TX bytes:25323 (24.7 KiB)

vlan0     Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1926381 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1318641 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2031854053 (1.8 GiB)  TX bytes:112171096 (106.9 MiB)

vlan1     Link encap:Ethernet  HWaddr 00:0F:66:3E:1B:F1
          inet addr:192.168.254.1  Bcast:192.168.254.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:1311069 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1879989 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:99158790 (94.5 MiB)  TX bytes:2048119669 (1.9 GiB)


~ # ip route show
10.8.0.5 dev tun0  proto kernel  scope link  src 10.8.0.6                 <--- the ip assigned to my WRT
10.8.0.1 via 10.8.0.5 dev tun0                                            <--- the ip of my vpn server
192.168.5.0/24 dev br0  proto kernel  scope link  src 192.168.5.1         <--- my lan network
200.76.225.0/24 via 10.8.0.5 dev tun0                                     <--- pushed network i sent to debug
192.168.254.0/24 dev vlan1  proto kernel  scope link  src 192.168.254.1   <--- WAN network of my router
169.254.0.0/16 dev br0  proto kernel  scope link  src 169.254.255.1
127.0.0.0/8 dev lo  scope link
default via 192.168.254.254 dev vlan1





This is what ive tried so far with no success 


ip rule add lookup main prio 32766
ip rule add lookup default prio 32767
ip rule add from 10.8.0.6 table 100 prio 100
ip rule add fwmark 0x100 table 100 prio 101
ip route flush table 100
for TABLE in 100
do
   ip route | grep link | while read ROUTE
   do
      ip route add table $TABLE to $ROUTE
   done
done
ip route add table 100 default via 10.8.0.5
iptables -t mangle -A PREROUTING -i tun0 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100
iptables -t mangle -A POSTROUTING -o tun0 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100
iptables -A POSTROUTING -t nat -m mark --mark 0x100 -j SNAT --to-source 10.8.0.6
iptables -t mangle -A PREROUTING -i br0 -m multiport -p tcp --dport 222,22 -j MARK --set-mark 0x100