среда, 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"

среда, 31 августа 2011 г.

Прошивка TP-Link TL-WR841ND

TFTP install

Beware that this installation method needs a TTL level serial console and a working TFTP server and should not be attempted unless you have experience with this sort of thing or are eager to learn :)
This is taken more or less verbatim from https://forum.openwrt.org/viewtopic.php?id=24203, thanks to dl3daz.
- Download http://downloads.openwrt.org/backfire/10.03/ar71xx/openwrt-ar71xx-tl-wr841nd-v5-squashfs-factory.bin to your TFTP server. - Hook your routers WAN ethernet port up to your network - Hook up the serial console as explained in the section "serial console" and do the "tpl" trick to get console access - Now we need to set router and server IP addresses (here named ROUTERIP and SERVERIP, substitute these with the real IP addresses). Type in the console:
setenv ipaddr ROUTERIP
setenv serverip SERVERIP
printenv
- Double check that the output of printenv lists the IP addresses you just set. Now we can load the firmware over TFTP with "tftpboot 0x80000000 openwrt-ar71xx-tl-wr841nd-v5-squashfs-factory.bin":
ar7240> tftpboot 0x80000000 openwrt-ar71xx-tl-wr841nd-v5-squashfs-factory.bin
Using eth0 device
TFTP from server 192.168.32.253; our IP address is 192.168.32.246
Filename 'openwrt-ar71xx-tl-wr841nd-v5-squashfs-factory.bin'.
Load address: 0x80000000
Loading: checksum bad
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################################################
done
Bytes transferred = 3932160 (3c0000 hex)
- Note the "3c0000" in the last line (your number may differ). Now execute the following commands, if necessary replacing 3c0000 with the number you got from tftpboot:
ar7240> erase 0x9f020000 +0x3c0000
...
ar7240> cp.b 0x80000000 0x9f020000 0x3c0000
ar7240> bootm 0x9f020000

четверг, 18 августа 2011 г.

Postfix. Не уходят письма во внеший мир. Очистка цепочек

 Проверка цепочки

    tail -f /var/log/mail.log

    postqueue -p
    
 

 Очистить все Postfix mail queue

Очистить все цепочки для Postfix сожно команду в одну строку:
~# for i in `mailq|grep '@' |awk {'print $1'}|grep -v '@'`; do postsuper -d $i ; done
Либо же:
postsuper -d ALL
или:

postsuper -d ALL deferred tail -f /var/log/mail.log

 Не уходят письма во внеший мир.

ispCPhosting:~# tail -f /var/log/mail.log

Aug 19 03:06:05 hosting postfix/qmgr[2461]: 6D3D3160061: from=, size=2953, nrcpt=1 (queue active)
Aug 19 03:06:05 hosting postfix/smtpd[3084]: disconnect from localhost[127.0.0.1]
Aug 19 03:06:08 hosting postfix/smtp[3087]: connect to e.mx.mail.yahoo.com[67.195.168.230]:25: Connection refused
Aug 19 03:06:08 hosting postfix/smtp[3087]: connect to b.mx.mail.yahoo.com[74.6.136.65]:25: Connection refused
Aug 19 03:06:08 hosting postfix/smtp[3087]: 6D3D3160061: to=, relay=none, delay=3, delays=0.2/0.01/2.8/0, dsn=4.4.1, status=deferred (connect to k.mx.mail.yahoo.com[98.139.54.60]:25: Connection refused)

На хостинге в сети провайдера:

ispCPhosting:~# telnet k.mx.mail.yahoo.com 25Trying 98.139.54.60...
telnet: Unable to connect to remote host: Connection refused

У провайдера на шлюузе во внешний мир:

gatewayISP:~# telnet k.mx.mail.yahoo.com 25
Trying 98.139.54.60...
Connected to k.mx.mail.yahoo.com.
Escape character is '^]'.
220 mta1224.mail.ac4.yahoo.com ESMTP YSmtp service ready
Connection closed by foreign host. 

Отсюда делаем вывод что закрыт 25 порт на выход во внешний мир из внутренней сети провайдера. 

Провайдеру необходимо у себя на шюзе добавить правила:

iptables -I FORWARD -d 195.xxx.xxx.130  -o eth4.294 -p tcp --dport 25 -j ACCEPT
iptables -I FORWARD -d 195.xxx.xxx.130  -o eth4.295 -p tcp --dport 25 -j ACCEPT
iptables -I FORWARD -s 195.xxx.xxx.130  -o eth4.294 -p tcp --dport 25 -j ACCEPT
iptables -I FORWARD -s 195.xxx.xxx.130  -o eth4.295 -p tcp --dport 25 -j ACCEPT

 

Изменить email  по умолчанию для администратора панели ispCP Omega можно в файле:

/etc/ispcp/ispcp.conf