Pptp ������ ��������� linux

How to configure a Linux PPTP VPN client

Configuring a VPN client connection is a simple matter of point and click in Windows OSes, but in Linux it is involves installing a package, configuring passwords, VPN server settings and finally routing the traffic destined for the VPN network via the VPN connection. The package named pptp is used on the client side for configuring a connection. To setup a VPN server read How to setup a VPN Server in Windows Server 2008. This tutorial is for both Debian Linux variants and Red Hat Linux variants.

Fedora/Red Hat/CentOS PPTP Client Installation

Install the pptp client

yum install pptp

Debian/Ubuntu PPTP Client Installation

Use the apt-get command

apt-get install pptp-linux

Configuring VPN credentials and server settings

Edit the following file and enter your VPN username and password

The syntax of the file is as follows

DOMAIN\\username PPTP vpnpassword *

For example to configure a user named jesin on example.com with pass1 as the password enter

EXAMPLE\\jesin PPTP pass1 *

If your VPN network doesn’t come under a domain replace DOMAIN with your VPNSERVER name.

Next is to configure the VPN server settings. Create and edit a new file under the peers directory

Add content according to the syntax below

pty «pptp vpn-server-hostname-or-ip-address —nolaunchpppd»
name DOMAIN\\username
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam vpnconnection1

Here “DOMAIN\\username” is the same as the one entered in the chap-secrets file. The ipparam should contain the name of the newly created file, in this case it is “vpnconnection1”

Adding a route to the routing table

All traffic for the VPN network should pass through the VPN interface so an entry has to be added to the routing table. To automatically add an entry whenever a VPN connection is established create and edit the following file

Add the following content

#!/bin/bash
route add -net 10.0.0.0/8 dev ppp0

Make the file executable

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

Testing the connection

To connect using the newly created VPN connection use the following command

pppd call vpnconnection1

Take a peek into the messages log file using the following command

tail -f /var/log/messages

you should see something similar to this

Nov 27 13:46:20 server1 kernel: [ 800.071028] PPP generic driver version 2.4.2
Nov 27 13:46:20 server1 pppd[1083]: pppd 2.4.5 started by root, uid 0
Nov 27 13:46:20 server1 pppd[1083]: Using interface ppp0
Nov 27 13:46:20 server1 pppd[1083]: Connect: ppp0 /dev/pts/0
Nov 27 13:46:25 server1 pppd[1083]: CHAP authentication succeeded
Nov 27 13:46:25 server1 kernel: [ 804.683790] padlock: VIA PadLock Hash Engine not detected.
Nov 27 13:46:25 server1 kernel: [ 804.687408] PPP MPPE Compression module registered
Nov 27 13:46:25 server1 pppd[1083]: MPPE 128-bit stateless compression enabled
Nov 27 13:46:26 server1 pppd[1083]: local IP address 10.0.0.11
Nov 27 13:46:26 server1 pppd[1083]: remote IP address 10.0.0.12

Try pinging a system in the VPN network and you should get proper replies.

Disconnecting the connection

To disconnect the PPTP VPN connection use the killall command

Читайте также:  Почему оперативная память сильно загружена windows 10

Источник

PPTP Client

pptpclient is a program implementing the Microsoft PPTP protocol. As such, it can be used to connect to a Microsoft VPN network (or any PPTP-based VPN) provided by a school or workplace.

Contents

Installation

Configure

To configure pptpclient you will need to collect the following information from your network administrator:

  • The IP address or hostname of the VPN server.
  • The username you will use to connect.
  • The password you will use to connect.
  • The authentication (Windows) domain name. This is not necessary for certain networks.

You must also decide what to name the tunnel.

Configure using pptpsetup

You can configure and delete tunnels by running the pptpsetup tool as root. For example:

You can #Connect after a tunnel has been configured.

Configure by hand

You can also edit all necessary configuration files by hand, rather than relying on pptpsetup.

Edit The options File

The /etc/ppp/options file sets security options for your VPN client. If you have trouble connecting to your network, you may need to relax the options. At a minimum, this file should contain the options lock , noauth , nobsdcomp and nodeflate .

Edit The chap-secrets File

The /etc/ppp/chap-secrets file contains credentials for authenticating a tunnel. Make sure no one except root can read this file, as it contains sensitive information.

Edit the file. It has the following format:

Replace each bracketed term with an appropriate value. Omit \\ if your connection does not require a domain.

Name Your Tunnel

The /etc/ppp/peers/ file contains tunnel-specific configuration options. is the name you wish to use for your VPN connection. The file should look like this:

Again, omit \\ if your connection does not require a domain. is the remote address of the VPN server, is the domain your user belongs to, is the name you will use to connect to the server, and is the name of the connection.

in the /etc/ppp/chap-secrets File.

Connect

To make sure that everything is configured properly, as root execute:

If everything has been configured correctly, the pon command should not terminate. Once you are satisfied that it has connected successfully, you can terminate the command.

To connect to your VPN normally, simply execute:

Where is the name of the tunnel you established earlier. Note that this command should be run as root.

Routing

Once you have connected to your VPN, you should be able to interact with anything available on the VPN server. To access anything on the remote network, you need to add a new route to your routing table.

For more information on how to add routes, you can read this article which has many more examples: PPTP Routing Howto

Split Tunneling

Packets with a destination of your VPN’s network should be routed through the VPN interface (usually ppp0 ). To do this, you create the route:

This will route all the traffic with a destination of 192.168.10.* through your VPN’s interface, ( ppp0 ).

Route All Traffic

It may be desirable to route all traffic through your VPN connection. You can do this by running:

Route All Traffic by /etc/ppp/ip-up.d

Make sure the script is executable.

Split Tunneling based on port by /etc/ppp/ip-up.d

Make sure the script is executable and that the vpn table is added to /etc/iproute2/rt_tables

Disconnect

Execute the following to disconnect from a VPN:

is the name of your tunnel.

Making A VPN Daemon and Connecting On Boot

This article or section is out of date.

Читайте также:  Установить биос для линукса

You can create a simple daemon for your VPN connection by creating an appropriate /etc/rc.d/* script:

To resolve this issue, you can patch your /usr/bin/poff file by making the following changes on line 93:

Troubleshooting

If client connections keep timing out with «LCP: timeout sending Config-Requests», make sure that GRE is allowed through the client firewall. For iptables, the necessary command is:

Alternatively, if you only want to allow PPTP traffic that corresponds to a connection request coming from your local machine, you can use the conntrack PPTP helper:

The second line should autoload the nf_conntrack_pptp and nf_conntrack_proto_gre kernel modules, which are needed for this.

If you get “EAP: unknown authentication type 26; Naking”, open /etc/ppp/options.pptp and commented out the lines refuse-chap and refuse-mschap and add the options file entry to the tunnel file like this:

Remarks

You can find more information about configuring pptpclient at their website: pptpclient website. The contents of this article were adapted from their Ubuntu How-To which also provides some hints on how to do things such as connecting on boot. These examples should be easy to adapt into daemons or other scripts to help automate your configuration.

Источник

RussianProxy.ru

Вход на сайт

Настройка PPTP клиента в Debian Ubuntu

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Источник

Linuxoid

OpenSource forever

Подключаемся по PPTP

Настройка VPN подключения по протоколу PPTP (Point-to-Point Tunneling Protocol) во многом напоминает подключение по PPPoE. До недавнего времени в Linux из-за опасения лицензионных преследований по поводу протокола MPPE отсутствовала нормальная поддержка PPTP, что вызывало проблемы и требовало лишних телодвижений.

Читайте также:  Windows те не выключать экран

Полная поддержка этого протокола появилась, начиная с версии 2.6.13, официальная была начата с 2.6.14, а в 2.6.15 уже включен модуль шифрования PPP MPPE.
Все что нам нужно есть в репозитарии пакетов:

$ sudo apt-cache search pptp
pptp-linux — Point-to-Point Tunneling Protocol (PPTP) Client
knet — The Knet is a frontend to pppd.
kvpnc — vpn clients frontend for KDE
network-manager-pptp — network management framework (PPTP plugin)

Клиентскую часть обеспечивает проект PPTP Client (pptpclient.sourceforge.net) . Поддерживается не только Linux, но и *BSD. Этот клиент совместим со всеми серверами, работающими по протоколу PPTP: Windows VPN, Linux PopTop, Cisco PIX и некоторыми другими. Клиент уже около 2 лет не обновлялся, поэтому можно устанавливать то, что есть в репозитарии.

$ sudo apt-get install pptp-linux

В качестве рекомендуемых пакетов в Ubuntu 7.10 предлагался «kernel-patch-mppe«, в моем случае все работало и без него, но при появлении проблем можно попробовать установить и его. Хотя я бы поставил самое последнее ядро, где этот протокол поддерживается изначально.
Кстати, следует отметить предусмотрительность ребят из Canonical. Все нужные пакеты для подключения по PPTP находятся на CD диске, который и попросят вставить в привод после ввода команды. Поэтому если PPTP — это единственная связь с внешним миром, добывать нужные пакеты окольными путями не придется.
Теперь приступаем к редактированию конфигурационного файла:

$ sudo mcedit /etc/ppp/options.pptp

lock noauth nobsdcomp nodeflate
# Отключаем ненужные проверки
refuse-pap
refuse-eap
#refuse-chap
refuse-mschap
persist
# Количество попыток подключения в случае обрыва соединения
maxfail 10
defaultroute
replacedefaultroute

В файл /etc/ppp/chap-secrets заносим логин и пароль в таком виде:

user pptp password *

Если требуется войти в домен, тогда запись должна выглядеть так:

domain\\user pptp password *

И создаем описание подключения, как это делали для PPPoE:

$ sudo mcedit /etc/ppp/peers/pptp
# Указываем адрес PPTP сервера
pty «pptp 10.10.10.1 —nolaunchpppd»
connect /bin/true
name user
# Идентификатор из второго поля в chap-secrets
remotename pptp
# Подключаем файл настроек
file /etc/ppp/options.pptp
#require-mppe-128 # с некоторыми провайдерами возникает проблема
require-mppe-40
ipparam pptp

Вот, собственно, и все настройки. Теперь подключаемся:

$ pon pptp

И смотрим вывод команды ifconfig. Если соединение установлено, и адрес получен, то считаем, что процесс настройки прошел успешно. Но обычно возни с PPTP несколько больше, чем с PPPoE. В случае неудачи выполняем:

$ pon pptp debug dump logfd 2 nodetach

В результате получим все параметры соединения и лог ошибок. Если есть необходимость в автоматическом подключении при загрузке системы, правим /etc/network/interfaces:

$ sudo mcedit /etc/network/interfaces
auto tunnel
iface tunnel inet ppp
provider pptp

Ошибки

Теперь об ошибках с которыми доводилось сталкиваться. Нормальная Нормальная поддержка MPPE появилась в 2.6.15 поэтому если ошибка не понятна можно MPPE попробовать отключить:

nomppe-40
nomppe-128
nomppe
nomppe-stateful

Далее такой вывод.

debug: [pppd] anon warn[open_inetsock:pptp_callmgr.c:326]: connect: No route to host
error: No route to host.

Это скорее всего показывает на проблему с роутингом. Следует проверить маршрут командой route и добавить в случае необходимости.Например так.

$ sudo route add default gw 192.168.1.1

Попытка использовать ms-chap аутентификацию, которая не поддерживается. Лечится «refuse-mschap».

pppd: The remote system is required to authenticate itself
pppd: but I couldn’t find any suitable secret (password) for it to use to do so.

Это значит что скрипт он не может найти нужную запись в chap-secrets. Проверяем соответствие второго поля и remotename. Если CHAP запись одна можно обойтись без remotename и указать * во втором поле.

Вроде все. Буду рад дополнениям.

4 комментария

А как быть с MPPC сжатием?

Ну что никто не сталкивался с данной проблемой, ладно если на сервере отключили компрессию, но обычно она включена. Остается только патчик? Но он нарушает патент от M$. Кто что выскажет по этому поводу?

Источник

Оцените статью