Перейти к содержимому

Pppd ubuntu как клиент

  • автор:

RussianProxy.ru

Для работы Ubuntu Server в качестве PPTP-клиента необходимо установить пакет pptp-linux:

sudo apt-get install pptp-linux

Основные настройки пакета, применяемые ко всем PPTP соедниненям по умолчанию хранятся в /etc/ppp/options.pptp, в большинстве случаев менять их нет необходимости, однако вы можете добавить какие-то свои опции, общие для всех соединений.

Для настройки подключения создадим в /etc/ppp/peers файл настроек с его именем:

sudo touch /etc/ppp/peers/test-vpn

Откроем его и внесем следующее содержимое:

pty "pptp pptp-l2tp-vpn-russia-1.atomintersoft.com --nolaunchpppd" #тип и адрес сервера , как пример pptp-l2tp-vpn-russia-1.atomintersoft.com
name vpnuser #логин
remotename TEST #имя соединения
require-mppe-128 #включаем поддержку MPPE
defaultroute #создавать маршрут по умолчанию
replacedefaultroute #принудительно изменять маршрут по умолчанию
unit 12 #номер ppp интерфейса
persist #переподключаться при обрыве
maxfail 10 #количество попыток переподключения
holdoff 15 #интервал между подключениями
file /etc/ppp/options.pptp
ipparam $TUNNEL

Номер ppp интрефейса создает для подключения всегда один и тот же сетевой интерфейс, в нашем случае это будет ppp12.

Отдельно стоит остановиться на наборе опций для автоматического переподключения. Мы настоятельно советуем ограничить количество попыток (0 — неограничено) разумным числом и не ставить слишком маленький промежуток времени. Это позволит ограничить нагрузку на VPN-сервер в случае проблем с подключением (например нет денег на балансе или изменились учетные данные).

Теперь укажем авторизационные данные для нашего пользователя, для этого в файл /etc/ppp/chap-secrets добавим следующую строку:

"vpnuser" TEST "vpnpassword"

которая предусматривает использование указанных учетных данных, где vpnpassword -пароль соединения, для удаленного соеднинения TEST (это имя мы указали в опции remotename).
Теперь самое время проверить наше соединение. Первый раз лучше запустить его в интерактивном режиме, тогда все сообщения об ошибках и ходе подключения вы будете видеть прямо в консоли:

pon test-vpn nodetach

В дальнейшем управлять соединением можно при помощи команд pon и poff (подключить и отключить соответственно).

Чтобы автоматически поднимать соединение при запуске системы в файл /etc/network/interfaces добавим секцию:

auto tunnel
iface tunnel inet ppp
provider test-vpn

Для доступа в корпоративную сеть может понадобиться добавление статических маршрутов, это тоже можно делать автоматически, для этого в конец созданой секции добавим строку:

up route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.222

Мы привели реальный маршрут используемый в нашем случае, вы должны указать здесь свои данные, если они не известны — уточните их у системного администратора.

Перезапустим сеть и убедимся что все работает правильно:

sudo /etc/init.d/networking restart

Для получения списка маршрутов воспользуйтесь командой route, также можно пропинговать какой-нибудь внутренний хост.

При подключении к сети интернет через PPTP бывают ситуации, когда, несмотря на указанные опции, нулевой маршрут через туннель не устанавливается. В этом случае можно в конец соответсвующей секции в /etc/network/interfaces добавить:

up route del default
up route add default dev ppp12

где ppp12 — имя вашего ppp интерфейса.

© 1996-2023 RussianProxy.ru — Outline ShadowSocks / PPTP / L2TP / OpenVPN TCP / OpenVPN UDP VPN сервис, русский выделенный IP, безлимитные тарифы.

toshas / install_pptp.txt

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

Setting PPTP VPN on Ubuntu
One time actions:
1. sudo create /etc/ppp/peers/us-office with the following contents:
===
pty «pptp —nolaunchpppd»
name
remotename PPTP
require-mppe-128
file /etc/ppp/options
ipparam us-office
===
2. sudo edit /etc/ppp/chap-secrets:
===
PPTP *
===
To connect:
sudo pppd call us-office
sudo route add 10.1.0.19 dev ppp0
Disconnect:
sudo poff us-office

Set up Linux PPTP Client from the Terminal

Linux penguin

A Virtual Private Network, or VPN, allows the client computer to connect to a remote local network to use it’s resources such as printers and file shares. There are several types of VPN such as PPTP and LP2SEC with varying types of protection. PPTP is not the most secure type of VPN but its the easiest to set up.

PPTP has numerous security risks which means that the data you are transferring through your VPN can easily be unencrypted. L2TP/IPsec is becoming the standard VPN technology of choice. PPTP should not be used unless security of each end point and the data transferred is not required.

Take the quick VPN Poll to tell us what type of VPN you use.

This tutorial assumes you have a PPTP server already set up with the following details:

  • Hostname: pptp.jamescoyle.net
  • Username: pptpuser
  • Password: pptppassword

Open a Terminal and install the required PPTP client packages.

apt-get install pptp-linux network-manager-pptp

Create a credentials file with the username and password of the PPTP server:

vi /etc/ppp/chap-secrets

Add your entry using the below attributes

  • [USER] – user name to log in to the VPN server
  • [SERVER] – name of server to use, PPTP in our case.
  • [SECRET] – password of the above [USER].
  • [IP] – ip of the server, * means all IPs.
[USER] [SERVER] [SECRET] [IP]
pptpuser PPTP pptppassword *

Create a file which will be executed when the PPTP connection is started. This can contain additional commands to run when the connection is started such as adding new routes or firewall exceptions.

vi /etc/ppp/ip-up.d/route-traffic

The below examle script adds a route from the PPTP connection to any computers on the PPTP servers local network with IPs in the 10.0.0.0 or 192.0.0.0 ranges. This means that on the PPTP client, any machines on the above IP ranges will be accessible. This script may not be required for your environment and is simply used as an example. Note: a route should automatically be added to your VPN gateway.

#!/bin/bash NET1=»10.0.0.0/8″ NET2=»192.0.0.0/8″ IFACE=»ppp0″ route add -net $ dev $ route add -net $ dev $

Allow execution of the script:

chmod +x /etc/ppp/ip-up.d/route-traffic

Add the PPTP client connection pool and any additional settings which are required. The connection name, jamescoyle.net, can be changed to suite your connection.

vi /etc/ppp/peers/jamescoyle.net

Add the details of the PPTP server. The below are the basic options required to connect to the server using mppe-128 encryption. Edit the below attributes to match your environment:

  • [USER] – user name to log in to the VPN server
  • [HOST] – host name or IP address of the PPTP server.
pty "pptp [HOST] --nolaunchpppd" name [USER] remotename PPTP require-mppe-128 file /etc/ppp/options.pptp ipparam jamescoyle.net

You must add rules to your firewall to allow connections to and from this interface as well as through your existing public interface to make the PPTP connection. The below rules open all traffic on the new pptp interface using iptables. You may need to change this once the connection has been tested to increase security.

iptables -A INPUT -i pptp -j ACCEPT iptables -A OUTPUT -o pptp -j ACCEPT

Finally you will need to start your PPTP client connection. Use pon and poff to start and stop your PPTP client. Replace [CONNECTION] with the name you gave to the file in /etc/ppp/peers/.

pon [CONNECTON] poff [CONNECTION]

Installing PPTP VPN on Ubuntu 20.x

Please note: if you unable to go this direction, probably you did not install PPTP Client, so install it:

apt install pptp-linux
touch PPTP

nano /etc/ppp/peers/PPTP

pty "pptp Your_Server_IP --nolaunchpppd --debug" name Your_Username password Your_Password remotename PPTP require-mppe-128 require-mschap-v2 refuse-eap refuse-pap refuse-chap refuse-mschap noauth debug persist maxfail 0 defaultroute replacedefaultroute usepeerdns

To save the file press Ctrl+X and enter Y to exit and then Enter key.
Note: To see your server IP address, login here with your username and password.

chmod 600 /etc/ppp/peers/PPTP
pon PPTP
poff PPTP
Installing PPTP VPN in Ubuntu 20.x using GUI (Graphical User Interface)
  • Go to the «Network Settings«: PPTP VPN connection on Ubuntu 20.x - Step 1PPTP VPN connection on Ubuntu 20.x - Step 1
  • In «Network» window, click on «+«: PPTP VPN connection on Ubuntu 20.x - Step 2
  • Choose «Point-to-Point Tunneling Protocol (PPTP)» as your connection type: PPTP VPN connection on Ubuntu 20.x - Step 3
  • In next screen, add your gateway address and your VPN username & password, then click «Advanced. » PPTP VPN connection on Ubuntu 20.x - Step 4

    Note: Gateway: To see your server IP address, login here with your username and password.

  • In advance settings, make sure the settings are the same as what is shown in the picture that is provided. Hit «OK» when done. PPTP VPN connection on Ubuntu 20.x - Step 5
  • Click on «Add» button: PPTP VPN connection on Ubuntu 20.x - Step 6
  • Now you are ready to connect. Click on network icon from tray area and connect to VPN. (or you can connect from Network window) Enjoy!: PPTP VPN connection on Ubuntu 20.x - Step 7
  • Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *