2015/07/19

利用小米路由mini智能翻墙

  1. echo "200 outwall" >> /etc/iproute2/rt_tables
  2. 修改firewall.user:
    ipset create outwall  iphash -exist
    ip rule add fwmark 1 table outwall
    iptables -t mangle -I PREROUTING -m set --match-set outwall dst -j MARK --set-mark 1
  3. 修改/etc/ppp/vpnup.sh:
    #!/bin/sh
    vpn_rule_ids=`ip rule list | grep 'lookup vpn' | sed 's/://g' | awk '{print $1}'`
    for rule_id in $vpn_rule_ids
    do
            ip ru del prio $rule_id
    done
    ip route add default dev pptp-vpn table outwall
  4. 修改/etc/ppp/ip-up.d/vpnup:
    #!/bin/sh
    export PATH="/bin:/sbin:/usr/sbin:/usr/bin"
    VPNGW=`ip route show | grep '^default' | grep 'pptp-vpn' | sed -e 's/default via \([^ ]*\).*/\1/ ' | head -1`
    if [ $VPNGW == '' ]; then
        exit 0
        fi
    if [ ! -e /tmp/vpngw ]; then
        echo $VPNGW >> /tmp/vpngw
        fi
    route del default gw $VPNGW
    route add -host 8.8.8.8 gw $VPNGW
  5.  执行:
    chmod a-x /etc/ppp/ppp.d/vpn-up
  6. 将下边地址下的三个文件放在/etc/dnsmasq.d/
    https://github.com/lifetyper/FreeRouter_V2/tree/master/OpenWRT/etc/dnsmasq.d
  7. 在路由器里配置vpn,名字为vpn。
  8. 重启路由器,应该可以翻墙了。
  9. 同理,在6的位置上可以搞定adblock的。
参考:
https://blog.sorz.org/p/openwrt-outwall/

2.3.51版测试通过。

没有评论:

发表评论

Mastodon Daily(2024-04-27)

I just watched The Happening (2008) https://trakt.tv/movies/the-happening-2008 #TheHappe...