mpd5 нас настройка
- uname -a
Ставим пакеты:
pkg install mpd5
pkg install dhcprelya
проверяем pf и отключаем правила ipfw (ipfw list)
Пример конфига:
/etc/rc.conf
hostname="ns2"
ifconfig_bce0="inet 17.219.33.25 netmask 255.255.255.252"
defaultrouter="17.219.33.23"
sshd_enable="YES"
mpd_enable="YES"
named_enable="YES"
#apache24_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
#vsftpd_enable="YES"
gateway_enable="YES"
######################################################################
# Interfaces
######################################################################
ifconfig_bce1="-lro -rxcsum -txcsum up"
ifconfig_em="-lro -rxcsum -txcsum up"
#ifconfig_em0="inet 10.140.0.0 netmask 255.255.255.0"
cloned_interfaces="
vlan150
vlan151
vlan152
vlan153
vlan154
vlan155
vlan1306
vlan1307
"
ifconfig_vlan150="inet 10.140.150.1 netmask 255.255.255.0 vlan 150 vlandev bce1"
ifconfig_vlan151="inet 10.140.151.1 netmask 255.255.255.0 vlan 151 vlandev bce1"
ifconfig_vlan152="inet 10.140.152.1 netmask 255.255.255.0 vlan 152 vlandev bce1"
ifconfig_vlan153="inet 10.140.153.1 netmask 255.255.255.0 vlan 153 vlandev bce1"
ifconfig_vlan154="inet 10.140.154.1 netmask 255.255.255.0 vlan 154 vlandev bce1"
ifconfig_vlan155="inet 10.140.155.1 netmask 255.255.255.0 vlan 155 vlandev bce1"
ifconfig_vlan1306="inet 10.140.156.1 netmask 255.255.255.0 vlan 1306 vlandev bce1"
ifconfig_vlan1307="inet 10.140.157.1 netmask 255.255.255.0 vlan 1307 vlandev bce1"
#ifconfig_vlan150="10.140.150.1/24 vlan 150 vlandev em0"
######################################################################
# NAT
######################################################################
dummynet_enable="YES"
######################################################################
# Pf
######################################################################
pf_enable="YES"
pf_rules="/etc/pf.conf"
pflog_enable="YES"
######################################################################
# ARP-Proxy
######################################################################
sysctl net.link.ether.inet.proxyall=1
######################################################################
# PPPTP
######################################################################
#pptp 17.219.34.3 Mikbill &
#mikbillvpn_enable="YES"
#mikbillvpn_type="auto"
######################################################################
# Dhcprelya
######################################################################
dhcprelya_enable="YES"
dhcprelya_servers="10.0.0.1"
dhcprelya_ifaces="vlan150 vlan151 vlan152 vlan153 vlan154 vlan155 vlan156 vlan157"
/etc/pf.conf
ext_in="bce1"
ext_out="bce0"
set limit states 500000
set optimization aggressive
#nat pass on $ext_out from 10.10.0.0/16 to any -> $ext_out
nat pass from 10.10.0.0/16 to any -> $ext_out
/usr/local/etc/mpd5/mpd.conf (ppoe)
cat /usr/local/etc/mpd5/mpd.conf
startup:
# configure mpd users
set user admin PASSWORD admin
# configure the console
set radsrv peer 17.219.34.3 secret
set radsrv self 17.219.33.25 3799
set radsrv open
set console self 127.0.0.1 5005
set console open
# configure the web server
set web self 0.0.0.0 5006
set web open
default:
load pptp_server
load pppoe_server
create bundle template C
set iface idle 1800
set iface enable tcpmssfix
set ipcp yes vjcomp
set ipcp ranges 172.20.20.20/32 ippool pool1
set ipcp dns 192.168.200.253 8.8.4.4
set bundle enable compression
set iface enable nat
create link template L pptp
set link action bundle C
# set link enable multilink
set link yes acfcomp protocomp
set link no eap
set link yes chap-msv1
set link yes chap-msv2
set link yes chap-md5
set link enable chap pap chap-msv2 chap-msv1
set link enable
set link keep-alive 30 120
set link mtu 1500
set link mru 1500
set link enable peer-as-calling
set pptp self 0.0.0.0
load server_common
pppoe_server:
create bundle template B
set iface idle 0
set iface enable tcpmssfix
set ipcp no vjcomp
set ipcp ranges 10.10.0.1/32 ippool pool1
set ipcp dns 8.8.8.8 8.8.4.4
set bundle enable compression
create link template common pppoe
set link mtu 1500
set link mru 1500
set link enable multilink
set link action bundle B
set link no eap
set link no chap-msv1
set link no chap-msv2
set link no chap-md5
set link enable chap pap
set link enable
set link yes acfcomp protocomp
set link enable report-mac
load server_common
set pppoe service "*"
create link template vlan150 common
set pppoe iface vlan150
set link enable incoming
create link template vlan151 common
set pppoe iface vlan151
set link enable incoming
create link template vlan152 common
set pppoe iface vlan152
set link enable incoming
create link template vlan153 common
set pppoe iface vlan153
set link enable incoming
create link template vlan154 common
set pppoe iface vlan154
set link enable incoming
create link template vlan155 common
set pppoe iface vlan155
set link enable incoming
create link template vlan1306 common
set pppoe iface vlan1306
set link enable incoming
create link template vlan1307 common
set pppoe iface vlan1307
set link enable incoming
server_common:
set link no eap
set link yes chap-md5
set link keep-alive 30 120
set link enable incoming
set link no acfcomp protocomp
load radius
radius:
set radius config /usr/local/etc/mpd5/radius.conf
set radius retries 3
set radius timeout 600
set radius 17.219.33.25
set radius identifier BSD
set auth acct-update 300
set auth enable radius-auth
set auth enable radius-acct
set radius enable message-authentic
- nano /usr/local/etc/mpd5/radius.conf
auth 17.219.34.3:1812 secret 1812 1813
acct 17.219.34.3:1813 secret 1812 1813
/etc/sysctl.conf
net.inet.ip.forwarding=1
net.inet.ip.dummynet.hash_size=1024
net.inet.ip.dummynet.pipe_slot_limit=1000
net.inet.ip.dummynet.io_fast=0
net.inet.icmp.drop_redirect=0
net.inet.icmp.maskrepl=0
net.inet.icmp.icmplim=10000
net.inet.icmp.log_redirect=0
net.inet.icmp.maskrepl=0
net.inet.icmp.bmcastecho=0
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.ip.fastforwarding=0
net.inet.ip.intr_queue_maxlen=4096
net.inet.tcp.msl=7500
net.inet.tcp.sack.enable=0
/etc/sysctl.conf
net.inet.ip.forwarding=1
net.inet.ip.dummynet.hash_size=1024
net.inet.ip.dummynet.pipe_slot_limit=1000
net.inet.ip.dummynet.io_fast=0
net.inet.icmp.drop_redirect=0
net.inet.icmp.maskrepl=0
net.inet.icmp.icmplim=10000
net.inet.icmp.log_redirect=0
net.inet.icmp.maskrepl=0
net.inet.icmp.bmcastecho=0
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.ip.fastforwarding=0
net.inet.ip.intr_queue_maxlen=4096
net.inet.tcp.msl=7500
net.inet.tcp.sack.enable=0
net.route.netisr_maxqlen=4096
net.link.ether.inet.max_age=600
kern.ipc.nmbclusters=262144
kern.ipc.nmbjumbop=262144
kern.ipc.maxsockbuf=83886080
net.graph.maxdgram=8388608
net.graph.recvspace=8388608
sysctl kern.ipc.maxsockbuf=24582912
sysctl kern.threads.max_threads_per_proc=15000
sysctl kern.maxfiles=123280
sysctl kern.maxfilesperproc=110950
sysctl kern.ipc.maxsockets=204800
sysctl kern.ipc.somaxconn=1024
sysctl net.inet.ip.intr_queue_maxlen=5000
sysctl net.inet.tcp.sendspace=3217968
sysctl net.inet.tcp.recvspace=3217968
sysctl kern.ipc.nmbclusters=256000
net.inet6.ip6.auto_linklocal=0
# Disable IPFW
net.inet.ip.fw.enable=0
net.inet6.ip6.fw.enable=0
на centos (pptp сервер):
- yum -y install pptpd
- nano /etc/pptpd.conf
localip 10.0.0.1
remoteip 10.0.0.2
nano /etc/ppp/chap-secrets
LOGIN pptpd PASSWORD *
- chkconfig pptpd on
Настраиваем поднятие маршрута при подключении. Секцию case включить если насов несколько.
- nano /etc/ppp/ip-up
#!/bin/bash
# This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead
#PATH=/sbin:/usr/sbin:/bin:/usr/bin
#export PATH
#LOGDEVICE=$6
#REALDEVICE=$1
#[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post --realdevice ${REALDEVICE} ifcfg-${LOGDEVICE}
#/etc/ppp/ip-up.ipv6to4 ${LOGDEVICE}
#[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
#case "$5" in
# 17.219.33.25)
/sbin/route add -net 10.140.0.0/16 gw 10.0.0.2
# ;;
# *)
#esac
exit 0
# This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead
#PATH=/sbin:/usr/sbin:/bin:/usr/bin
#export PATH
#LOGDEVICE=$6
#REALDEVICE=$1
#[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post --realdevice ${REALDEVICE} ifcfg-${LOGDEVICE}
#/etc/ppp/ip-up.ipv6to4 ${LOGDEVICE}
#[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
#case "$5" in
# 17.219.33.25)
/sbin/route add -net 10.140.0.0/16 gw 10.0.0.2
# ;;
# *)
#esac
exit 0
- service pptpd start
На freebsd настраиваем клиент
- pkg install pptpclient
- nano /etc/ppp/ppp.conf
Внизу дописываем (название без пробела в начале, остальные строчки с пробела в начале)
mikbillvpn:
set ifaddr 0 0
set authname LOGIN
set authkey PASSWORD
set timeout 0
disable vj pred1 deflate
deny vj pred1 deflate
set mppe * stateless
disable ipv6
disable ipv6cp
- nano /usr/local/etc/rc.d/mikbillvpn
#!/bin/sh
name="mikbillvpn"
rcvar="mikbillvpn_enable"
pidfile="/var/run/${name}.pid"
vpn_server="17.219.34.3"
conn_name="mikbillvpn"
#tun0_pid="/var/run/tun0.pid"
if [ `ls /var/run/pptp | wc -l` -eq 0 ]; then
{
/usr/local/sbin/pptp ${vpn_server} ${conn_name} & 2>&1
}
fi
- chmod +x /usr/local/etc/rc.d/mikbillvpn
- nano /etc/crontab
*/1 * * * * root /usr/local/etc/rc.d/mikbillvpn
Комментарии
Отправить комментарий