среда, 7 сентября 2011 г.

Vpn client OpenWRT (TODO)

Редактировать
 /etc/ppp/options.pptp
#
    lock

    #
    # We don't need the tunnel server to authenticate itself
    #
    noauth

    #
    # Turn off transmission protocols we know won't be used
    #
    nobsdcomp
    nodeflate
   
    #
    # We want MPPE
    # (option naming specific to ppp 2.4.0 with unofficial patch)
    #
    #mppe-40
    #mppe-128
    #mppe-stateless
    debug   
    #
    # We want a sane mtu/mru
    # (ppp 2.4.0 with unofficial patch)
    #
    #mtu 1000
    #mru 100


 ___
Редактировать
 /etc/ppp/ip-up.d/route_up

#!/bin/bash
H=`ps aux | grep 'pppd pty' | grep -v grep | awk '{print $14}'`
DG=`route -n | grep UG | awk '{print $2}'`
DEV=`route -n | grep UG | awk '{print $8}'`
route add -host $H gw $DG dev $DEV
route del default $DEV
route add default dev ppp0


 _______


 /etc/ppp/ip-down.d/route_down

#!/bin/bash
H=`route -n | grep UGH | awk '{print $1}'`
DG=`route -n | grep UGH | awk '{print $2}'`
DEV=`route -n | grep UGH | awk '{print $8}'`
route del -host $H
route add default gw $DG dev $DEV




vi /etc/init.d/custom-user-startup
kill $(pgrep pppd)
sleep 20
pppd pty "pptp 195.234.200.251 --nolaunchpppd" file /etc/ppp/options.pptp user test777  password 777


root@OpenWrt:~# vi /etc/config/network

config interface loopback
        option ifname   lo
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config interface lan
        option ifname   eth0
        option type     bridge
        option proto    static
        option ipaddr   192.168.1.1
        option netmask  255.255.255.0

config interface wan
        option ifname   eth1
        option 'proto' 'dhcp'

        #option 'proto' 'static'

        #option 'defaultroute' '0'
        #option 'peerdns' '0'
        #option 'dns' '195.234.200.253'
        #option 'ipaddr'  '195.234.203.134'
        #option 'netmask' '255.255.255.248'
        #option 'gateway' '195.234.203.129'

        option 'macaddr' '00E04C77E13C'

config 'interface' 'vpn'
        option 'proto' 'pptp'
        option 'ifname' 'pptp-vpn'
        option 'username' 'test777
        option 'password' '777'
        option 'server' '195.234.200.251'
        option 'buffering' '1'

config switch eth0
        option enable_vlan      1

config switch_vlan
        option device   eth0
        option vlan     1
        option ports    "0 1 2 3 4"