|
I Enviroments
Ubuntu 14.04 LTS/16.04 LTS
iptables
II Prerequisites
1. PPTP
$ sudo apt-get install pptpd
# install pptpd
$ sudo vi /etc/pptpd.conf
# Uncommnet the following contents
# localip 192.168.0.1
# remoteip 192.168.0.234-238,192.168.0.245
$ sudo vi /etc/ppp/pptpd-options
# Uncommnet and change the following contents
# ms-dns 8.8.8.8
# ms-dns 114.114.114.114
$ sudo vi /etc/ppp/chap-secrets
# Insert user and password.
username pptpd userpassword *
$ sudo vi /etc/sysctl.conf
# Uncommnet the following contents
# net.ipv4.ip_forward=1
$ sudo sysctl -p
# Display "net.ipv4.ip_forward = 1".
2. iptables
$ sudo apt-get install iptables
# Install iptables.
$ sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
# Insert the forwarding rules.
$ sudo touch /etc/iptables.rules
# Create forwarding rules file.
$ sudo chmod a+w /etc/iptables.rules
# Change the permission.
$ sudo iptables-save > /etc/iptables.rules
# write permissions into file.
$ sudo vi /etc/network/interfaces
# Add the following content into the end of file.
pre-up iptables-restore < /etc/iptables.rules
$ sudo /etc/init.d/pptpd restart
# Restart the service.
$ sudo vi /etc/rc.local
# Add the following content into the end for self-starting.
/etc/init.d/pptpd restart
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-25 08:08
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社