浏览模式: 标准 | 列表 网络杂事

[转]CentOS 6、7下pptp vpn一键安装脚本

 https://blog.linuxeye.cn/412.html

  • wget http://mirrors.linuxeye.com/scripts/vpn_centos.sh
  • chmod +x ./vpn_centos.sh
  • ./vpn_centos.sh

#!/bin/bash

#

# Author:  yeho <lj2007331 AT gmail.com>

# Blog:  //blog.linuxeye.com

#

# Installs a PPTP VPN-only system for CentOS

# Check if user is root

[ $(id -u) != "0" ] && { echo -e "\033[31mError: You must be root to run this script\033[0m"; exit 1; }

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

clear

printf "

#######################################################################

#    LNMP/LAMP/LANMP for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+    #

#            Installs a PPTP VPN-only system for CentOS               #

# For more information please visit //blog.linuxeye.com/31.html  #

#######################################################################

"

[ ! -e '/usr/bin/curl' ] && yum -y install curl

VPN_IP=`curl ipv4.icanhazip.com`

VPN_USER="linuxeye"

VPN_PASS="linuxeye"

VPN_LOCAL="192.168.0.150"

VPN_REMOTE="192.168.0.151-200"

while :; do echo

    read -p "Please input username: " VPN_USER

    [ -n "$VPN_USER" ] && break

done

while :; do echo

    read -p "Please input password: " VPN_PASS

    [ -n "$VPN_PASS" ] && break

done

clear

if [ -f /etc/redhat-release -a -n "`grep ' 7\.' /etc/redhat-release`" ];then

    #CentOS_REL=7

    if [ ! -e /etc/yum.repos.d/epel.repo ];then

        cat > /etc/yum.repos.d/epel.repo << EOF

[epel]

name=Extra Packages for Enterprise Linux 7 - \$basearch

#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch

failovermethod=priority

enabled=1

gpgcheck=0

EOF

    fi

    for Package in wget make openssl gcc-c++ ppp pptpd iptables iptables-services

    do

        yum -y install $Package

    done

    echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf

elif [ -f /etc/redhat-release -a -n "`grep ' 6\.' /etc/redhat-release`" ];then

    #CentOS_REL=6

    for Package in wget make openssl gcc-c++ iptables ppp

    do

        yum -y install $Package

    done

    sed -i 's@net.ipv4.ip_forward.*@net.ipv4.ip_forward = 1@g' /etc/sysctl.conf

    rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm

    yum -y install pptpd

else

    echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m"

    exit 1

fi

echo "1" > /proc/sys/net/ipv4/ip_forward

sysctl -p /etc/sysctl.conf

[ -z "`grep '^localip' /etc/pptpd.conf`" ] && echo "localip $VPN_LOCAL" >> /etc/pptpd.conf # Local IP address of your VPN server

[ -z "`grep '^remoteip' /etc/pptpd.conf`" ] && echo "remoteip $VPN_REMOTE" >> /etc/pptpd.conf # Scope for your home network

if [ -z "`grep '^ms-dns' /etc/ppp/options.pptpd`" ];then

     cat >> /etc/ppp/options.pptpd << EOF

ms-dns 223.5.5.5 # Aliyun DNS Primary

ms-dns 114.114.114.114 # 114 DNS Primary

ms-dns 8.8.8.8 # Google DNS Primary

ms-dns 209.244.0.3 # Level3 Primary

ms-dns 208.67.222.222 # OpenDNS Primary

EOF

fi

echo "$VPN_USER pptpd $VPN_PASS *" >> /etc/ppp/chap-secrets

ETH=`route | grep default | awk '{print $NF}'`

[ -z "`grep '1723 -j ACCEPT' /etc/sysconfig/iptables`" ] && iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT

[ -z "`grep 'gre -j ACCEPT' /etc/sysconfig/iptables`" ] && iptables -I INPUT 5 -p gre -j ACCEPT

iptables -t nat -A POSTROUTING -o $ETH -j MASQUERADE

iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356

service iptables save

sed -i 's@^-A INPUT -j REJECT --reject-with icmp-host-prohibited@#-A INPUT -j REJECT --reject-with icmp-host-prohibited@' /etc/sysconfig/iptables

sed -i 's@^-A FORWARD -j REJECT --reject-with icmp-host-prohibited@#-A FORWARD -j REJECT --reject-with icmp-host-prohibited@' /etc/sysconfig/iptables

service iptables restart

chkconfig iptables on

service pptpd restart

chkconfig pptpd on

clear

echo -e "You can now connect to your VPN via your external IP \033[32m${VPN_IP}\033[0m"

echo -e "Username: \033[32m${VPN_USER}\033[0m"

echo -e "Password: \033[32m${VPN_PASS}\033[0m"

CentOS增加SMB服务

这篇日志被加密了,请输入密码后查看。

discuz论坛程序目录从bbs下调整到根目录的rewrite规则

有个discuz论坛,原本在www.is36.com/bbs目录下,后来程序被移到了www.is36.com根目录下。但是搜索引擎以及网络上其它引用的地址还是www.is36.com/bbs的地址。

情况:Windows 2003企业版、IIS6.0、PHP

修改httpd.conf配置文件,在原本discuz的系统规则最下方加入如下规则:

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^bbs/(.*)$ http://www.is36.com/$1 [L,R=301]

2016年12306网站购票添加常用联系人超过上限解决办法

2016年1月27日记——今天上12306网站给一个朋友购票,添加常用联系人的时候提示超过上限。然后按照提示去看了官方的文件,显示是不能超过100个联系人。可是我只有18个联系人,怎么会超过呢?

无奈之下只好打12306客服电话,按0号键转人工服务。

最后终于知道目前设定为一个账号下只能添加15个常用联系人。

那么只需要删除4个不常用的联系人,添加朋友的身份证信息购票就可以了。

阿里云再次备案居然如此轻松

去年春天买了一个阿里云最基础的云主机ECS然后备案了,用了快一年才发现那个云主机属于代理商的,我压根没所有权,连续费都要找代理商。

等一年期快到的时候,果断又买了一个,这次所有权控制权都在自己账号下了,考虑到别人说变更备案(云主机IP变了)比重新备案还要麻烦,索性直接把原网站备案给注销了。

注销后再去阿里云ICP代备案管理系统注册一个新账号,然后提交备案:

  • 5月4日下午提交了初审
  • 5月4日傍晚初审通过,要求去核验点办理拍照
  • 5月5日早上直接把去年的照片上传,中午就审核通过,下午就传给管局了(奇怪居然不用邮寄材料了?!)
  • 过了一周时间,5月12日管局通过,备案号下发

解决“网上交易认证服务服务器未启动”的问题

在手机同花顺炒股软件里看到财通证券万2.5佣金,立马手机开户非常给力地完成了。

然而第二天拿到开户成功的资金账号后却一直无法登陆手机同花顺炒股软件。

  1. 输入资金账号,输入交易密码和通讯密码(一般首次登陆这2个密码是一样的)
  2. 如果没有错误的情况下,会要求更改通讯密码
  3. 修改提交的时候界面提示:网上交易认证服务服务器未启动

这个时候可以下载证券公司的股票交易软件进行登陆就可以修改了,比如我下载了财通证券的财通证券财运亨通2015版。

Tags: 财通证券, 万2.5佣金, 开户

给家用的TP-LINK和FAST路由器配电源适配器

几年下来,手头也累计了好几个路由器以及网络机顶盒,因为各种原因其中有2个路由器的电源适配器遗失了,也不能因为丢了个电源适配器就扔了路由器,淘宝一下就搞定了。

建议买“合理”价格的电源适配器,不要贪便宜买几块钱的不然真的把路由器给废了。

  • 11年12月12日,入手TP-LINK TL-WR941N 300M 无线宽带路由器,192.4元,9V~0.85A
  • 12年10月10日,入手FAST 迅捷 FW150R 150M无线路由器,49元,9V~0.6A
  • 13年11月12日,入手天猫魔盒TMB-100机顶盒,0.01元,5V~2A
  • 14年11月29日,入手newifi 新路由 mini 1200M AC双频智能路由器,125元,12V~1A
  • 15年3月25日,入手优酷土豆 YK-L1 路由宝 智能无线路由器,88元,12V~1A

9V~0.6A的电源适配器参考价14元包邮,9V~0.85A的电源适配器参考价22元包邮。同等电压,电流越大价格越贵。

苏宁14.12.11-15中午有活动

链接戳这里:http://sale.suning.com/images/advertise/008/boobox/index.html

注意1:每天12点12分-13点12分来抢~选择自提免运费

注意2:每个ID一天只能买1个,有机会中iPhone(就当玩玩)

5个不同的24元礼包如下:


另外这里可以玩玩0.1元秒杀~

http://sale.suning.com/images/advertise/001/chaoshi1212/index.html