Ostatnio: nigdy

Darmowe galerie dla serwisów aukcyjnych

PPTP Client on Ubuntu Server

Read first:

http://pptpclient.sourceforge.net/documentation.phtml

http://pptpclient.sourceforge.net/routing.phtml

Setup PPTP Server first: http://pokazywarka.pl/pptpd_centos_65/ or use MikroTik :)

Tested on Ubuntu Server 16.10

apt-get update

apt-cache search pptp

apt-get install pptp-linux

dpkg -L pptp-linux

dpkg -L ppp

man pptpsetup

man pppd

modprobe -v ip_gre ppp_mppe xt_connmark xt_mark nf_conntrack_proto_gre nf_conntrack_pptp nf_nat_proto_gre nf_nat_pptp

pptpsetup --create TUNNEL1 --server 1.2.3.4 --username ppp1 --password ppp1 --encrypt --start

poff TUNNEL1

echo persist >> /etc/ppp/peers/TUNNEL1

echo maxfail 0 >> /etc/ppp/peers/TUNNEL1

echo holdoff 10 >> /etc/ppp/peers/TUNNEL1

pon TUNNEL1 nodetach

... reconnections test ...

CTRL+C

cat /etc/ppp/chap-secrets

cat /etc/ppp/peers/TUNNEL1

ip a

watch -d -n 1 ifconfig

watch -d -n 1 iptables -L -vn --line-numbers

watch -n 1 -d ls -al /var/log

tail -f /var/log/syslog

You can watch a counters on firewall and interface, then you can correct your ppp+ interface with firewall and routing.

http://pptpclient.sourceforge.net/routing.phtml

vim /etc/ppp/ip-up.d/TUNNEL1

#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
logger ppp+  the interface name used by pppd is $1
logger ppp+  the tty device name is $2
logger ppp+  the tty device speed is $3
logger ppp+  the local IP address for the interface is $4
logger ppp+  the remote IP address is $5
logger ppp+  the parameter specified by the ipparam option to pppd is $6
if [ $1 = ppp0 ] && [ $6 = TUNNEL1 ]
then
route add -net 192.168.3.0/24 gw 10.20.30.2
#route add -net 192.168.3.0/24 dev $1
fi
exit 0

chmod a+x /etc/ppp/ip-up.d/TUNNEL1

poff TUNNEL1

pon TUNNEL1

apt-get install iptables-persistent netfilter-persistent

dpkg -L netfilter-persistent

dpkg -L iptables-persistent

sudo sysctl -w net.ipv4.ip_forward=1
$ sudo iptables -A FORWARD -i ppp+ -o eth0 -s 192.168.0.0/24 -d 192.168.0.0/24 -j ACCEPT
$ sudo iptables -A FORWARD -o ppp+ -i eth0 -s 192.168.0.0/24 -d 192.168.0.0/24 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 172.16.12.0/255.255.255.0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 80:81 -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DROP
-A OUTPUT -j DROP
COMMIT

and on the end we set up auto-start with your main network interface

vim /etc/network/interfaces

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
    post-up /sbin/ifup tunnel
    pre-down /sbin/ifdown tunnel

# PPTP Auto Start Client
iface tunnel inet ppp
    provider TUNNEL1

reboot

or just simple

auto tunnel1
iface tunnel1 inet ppp
    provider TUNNEL1

reboot

Komentarze

Dodaj komentarz

Dodajesz komentarz anonimowo. Zaloguj się.

Dodajesz komentarz anonimowo. Aby komentować pod własnym pseudonimem włącz profil publiczny w ustawieniach.

Autor:
Treść:

Aby przesłać formularz, musisz mieć włączony w przeglądarce Javascript. Jeżeli nie masz, przepisz wspak tekst 080429dp0m:

Wykop

Korzystanie z serwisu oznacza akceptację Regulaminu. Copyright – 1999-2017 INTERIA.PL , wszystkie prawa zastrzeżone.