View Single Post
Old 12-27-2012, 04:28 PM   #5
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,503
Karma: 5840130
Join Date: Feb 2012
Device: Too many.
Linux Rule Based Routing

Given the following pre-condition:

Wifi dhcpd is setup to assign addresses in the range of: 169.254.0.225/27 to wireless clients (a 32 client address space);

AND your home router/gateway device runs Linux.

Then:

OP='add' To add route prohibit to Amazon destinations (from Wireless devices only), or
OP='del' to remove an existing route prohibit.

PHP Code:
/bin/ip rule $OP from 169.254.0.225/27 to 207.171.160.0/19 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 107.20.0.0/14 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 184.72.0.0/15 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 204.246.160.0/19 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 205.251.192.0/18 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 72.21.192.0/19 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 50.16.0.0/14 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 23.0.0.0/12 prohibit

/bin/ip rule $OP from 169.254.0.225/27 to 23.20.0.0/14 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 54.240.0.0/12 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 54.240.128.0/18 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 64.208.0.0/16 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 64.209.0.0/17 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 178.236.0.0/21 prohibit
/bin/ip rule $OP from 169.254.0.225/27 to 176.32.96.0/21 prohibit 
(Yes, I know that looks a lot like Cisco - but its Linux )

Which results in a pretty set of routing rules for the router's network stack:
PHP Code:
root@Microknoppix:~# ip rule
0:    from all lookup local 
32751
:    from 169.254.0.225/27 to 176.32.96.0/21 prohibit
32752
:    from 169.254.0.225/27 to 178.236.0.0/21 prohibit
32753
:    from 169.254.0.225/27 to 64.209.0.0/17 prohibit
32754
:    from 169.254.0.225/27 to 64.208.0.0/16 prohibit
32755
:    from 169.254.0.225/27 to 54.240.128.0/18 prohibit
32756
:    from 169.254.0.225/27 to 54.240.0.0/12 prohibit
32757
:    from 169.254.0.225/27 to 23.20.0.0/14 prohibit
32758
:    from 169.254.0.225/27 to 23.0.0.0/12 prohibit
32759
:    from 169.254.0.225/27 to 50.16.0.0/14 prohibit
32760
:    from 169.254.0.225/27 to 72.21.192.0/19 prohibit
32761
:    from 169.254.0.225/27 to 205.251.192.0/18 prohibit
32762
:    from 169.254.0.225/27 to 204.246.160.0/19 prohibit
32763
:    from 169.254.0.225/27 to 184.72.0.0/15 prohibit
32764
:    from 169.254.0.225/27 to 107.20.0.0/14 prohibit
32765
:    from 169.254.0.225/27 to 207.171.160.0/19 prohibit
32766
:    from all lookup main 
32767
:    from all lookup default 
Google: Linux Rule Based Routing
If you haven't seen that used before.
(Yes, Virginia, it handles IPv6 also.)

Note: Your non-wireless devices (ANY device with an IP outside of the source range above) can still access all Amazon services.
I.E: Manually download what you want and push over USB to the Kindle. (Such as books you want to buy - not the books Amazon wants to sell you.)

Last edited by knc1; 12-27-2012 at 04:38 PM.
knc1 is offline   Reply With Quote