centos6.5 安裝pptp-vpn 伺服器

來源:互聯網
上載者:User

centos6.5 安裝pptp-vpn 伺服器

一、我用的是yum 安裝;

#yum -y install dkms ppp pptpd rpm-build gcc iptables #靜靜的等待

二、配置用戶端的擷取位址範圍;

#cat <<eof >>/etc/pptpd.conf

>localip 192.168.2.2

>remoteip 192.168.2.100-200

>eof

或者

#echo "localip 192.168.2.2" >>/etc/pptpd.conf

#echo "remoteip 192.168.2.100-200" >>/etc/pptpd.conf

三、設定伺服器的dns服務;

#echo "ms-dns 8.8.8.8" >>/etc/ppp/options.pptpd

#echo "ms-dns 8.8.4.4" >>/etc/ppp/options.pptpd

以上是追加到設定檔/etc/ppp/options.pptpd 擷取的dns服務。

五、配置路由轉寄,修改設定檔/etc/sysctl.conf找到;

net.ipv4.ip_forward = 0 # 把 0 改為 1

重新整理核心參數

#sysctl -p

六、配置VPN的帳號和密碼

# vim /etc/ppp/chap-secrets

# Secrets for authentication using CHAP

# client server secret IP addresses

user1 * user1 *

user2 * suer2 *

第一列是對應的帳號 第三列對應的是密碼 第四列是伺服器位址

七、配置防火牆設定;

#iptables -t filter -A INPUT -p tcp -m state NEW -m tcp --dport 1723 -j ACCEPT

#iptables -t filter -A INPUT -p tcp -m state NEW -m tcp --dport 22 -j ACCEPT

#iptables -t filter -A INPUT -p tcp -m state NEW -m tcp --dport 47 -j ACCEPT

#iptables -A INPUT -p gre -j ACCEPT

-----防火牆做nat轉寄設定(有兩種寫法----

#iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j SNAT --to-source=x.x.x.x(這裡對應的是你伺服器能上網的ip地址)這是第一種寫法。

#iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0(你的網卡名字) -j MASQUERADE #第二種寫法

#service iptables save

#chkconfig pptpd on

#chkconfig iptables on

#service pptpd start

#service iptables start

到此,我的vpn伺服器搭建完成了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.