环境:CentOS 6.5 64bit
①安装centos6.5下的×××服务
yum -y install wget perl ppp
modprobe ppp-compress-18 && echo ok
cat /dev/net/tun
如果这条指令显示结果为下面的文本,则表明通过:
cat: /dev/net/tun: File descriptor in bad state
上述两条均通过,才能安装pptp。
yum list installed ppp
rz -ey
ls
rpm -ivh pptpd-1.4.0-1.el6.x86_64.rpm [匹配系统自动安装的ppp文件的版本]
rpm -qa | grep pptpd
cd /etc/ppp/
ls
cp options.pptpd options.pptpd.bak20150303
ls
vim options.pptpd
////修改配置文件,按照下面的配置缺少什么添加什么
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
idle 2592000
ms-dns 8.8.8.8
ms-dns 8.8.4.4
///////
cp chap-secrets chap-secrets.bak20150303
ls
vim chap-secrets
////修改配置文件,按照下面的配置缺少什么添加什么
添加账户名、协议类型、密码、IP
[root@localhost etc]# vim /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
licong pptpd qweasdzxc *
///////
cd ../
cp pptpd.conf pptpd.conf.bak20150303
vim pptpd.conf
////修改配置文件,按照下面的配置缺少什么添加什么
logwtmp
localip 192.168.9.1
remoteip 192.168.9.11-30
///////
cp sysctl.conf sysctl.conf.bak20150303
vim sysctl.conf
////修改配置文件,按照下面的配置缺少什么添加什么
将net.ipv4.ip_forward = 0 改成 net.ipv4.ip_forward = 1
///////
sysctl -p
/sbin/sysctl -p
service pptpd start
service iptables start
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE
iptables -L -t nat
由于防火墙策略错误导致无法访问网络;调整防火墙策略后成功。
-------------------------------------------
[root@localhost ~]# cat /etc/rc.d/firewall
iptables -F
iptables -X
iptables -Z
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -s 118.26.133.240 -j ACCEPT
iptables -A INPUT -p tcp --dport 1723 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.100.0/24 -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -s 192.168.11.0/24 -j ACCEPT
iptables -A FORWARD -s 192.168.168.0/24 -o eth1 -j ACCEPT
iptables -A FORWARD -d 192.168.168.0/24 -i eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.168.0/24 -j MASQUERADE
[root@localhost ~]#
------------------------------------------------------------------------------
设置完成后将pptpd添加开机启动
chkconfig pptpd on
将iptables添加开机启动
chkconfig iptables on
重启服务
service pptpd restart
[root@localhost etc]# service pptpd restart
Shutting down pptpd: [确定]
Starting pptpd: [确定]
Warning: a pptpd restart does not terminate existing
connections, so new connections may be assigned the same IP
address and cause unexpected results. Use restart-kill to
destroy existing connections during a restart.
You have new mail in /var/spool/mail/root
出现这个报错是有连接没有关闭;执行下面这个操作就可以了
[root@localhost etc]# service pptpd restart-kill
[root@localhost etc]# service pptpd restart
报错无法访问网络
[root@localhost ~]# modprobe bridge
[root@localhost ~]# lsmod | grep bridge