bash指令碼Centos6.3下安裝VPN(pptpd)伺服器

來源:互聯網
上載者:User

bash指令碼Centos6.3下安裝VPN(pptpd)伺服器 #!/bin/bashfunction installVPN(){yum remove -y pptpd pppiptables --flush POSTROUTING --table natiptables --flush FORWARDrm -rf /etc/pptpd.confrm -rf /etc/ppp*yum install -y ppp iptablesecho 1 > /proc/sys/net/ipv4/ip_forwardcd /tmpwget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpmrpm -ivh pptpd-1.3.4-2.el6.x86_64.rpmcat >/etc/ppp/options.pptpd<<ENDname pptpdrefuse-paprefuse-chaprefuse-mschaprequire-mschap-v2require-mppe-128ms-dns 8.8.8.8ms-dns 8.8.4.4proxyarplocknobsdcompnovjnovjccompnologfdENDcat >/etc/pptpd.conf<<ENDoption /etc/ppp/options.pptpdlogwtmplocalip 10.10.10.1remoteip 10.10.10.205-254ENDiptables -t nat -A POSTROUTING -s 10.10.10/8 -o eth0 -j SNAT --to-source `ifconfig  | grep 'inet addr:'| grep -v '127.0.0' | cut -d: -f2 | awk 'NR==2 { print $1}'`iptables -A FORWARD -s `ifconfig  | grep 'inet addr:'| grep -v '127.0.0' | cut -d: -f2 | awk 'NR==2 { print $1}'`/32 -o eth0 -j ACCEPTservice pptpd startchkconfig --level pptpd 2345 onchkconfig pptpd onservice iptables savechkconfig iptables onservice iptables start}function addVPNuser(){echo "input user name:"read usernameecho "input password:"read userpasswordecho "${username} pptpd ${userpassword} *" >> /etc/ppp/chap-secretsservice pptpd restart-killservice pptpd startservice iptables restart}echo "which do you want to ? input the number."echo "1. install VPN service"echo "2. add VPN user"read numcase "$num" in[1] ) (installVPN);;[2] ) (addVPNuser);;*) echo "nothing,exit";;esacbash echo "Your VPN server configuration is complete,The default user password vpnuser as test123 Please run the script again to add custom user"進過多次測試,可以很正常運行vpn服務。:  未串連VPN伺服器ip配置和ping百度測試  串連VPN伺服器後的ip配置和ping百度測試

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.