#!/bin/bash if [ `whoami` = "root" ];then echo "root!" else echo "123" | passwd --stdin root fi mkdir /Download && cd /Download wget -c ftp://rpmfind.net/linux/epel/6/x86_64/pptpd-1.4.0-3.el6.x86_64.rpm yum install -y gcc if [ ! -f "pptpd-1.4.0-3.el6.x86_64.rpm" ];then rpm -ivh pptpd-1.4.0-3.el6.x86_64.rpm else echo "down file is worry,check it!" fi echo -e "localip 10.192.168.1 \nremoteip 10.192.168.100-200 ">>/etc/pptpd.conf echo "remoteip 10.192.168.100-200">>/etc/pptpd.conf echo "ms-dns 8.8.8.8" >> etc/ppp/options.pptpd echo "logfile /var/log/pptpd.log">>etc/ppp/options.pptpd echo -e "xxx \t*\txxx\t*">> /etc/ppp/chap-secrets sed -i ‘s/IPTABLES_MODULES=""/IPTABLES_MODULES="ip_nat_pptp"/g‘ /etc/sysconfig/iptables-config iptables -F iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1723 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT iptables -t nat -A POSTROUTING -s 10.192.168.0/255.255.255.0 -o eth0 -j MASQUERADE sed -i ‘s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g‘ /etc/sysctl.conf sysctl -p /etc/init.d/pptpd restart
适用于docker file
时间: 2024-10-31 22:25:40