Перейти к содержанию

Beeline internet Ubuntu Linux

Материал из Solipse Wiki

Install xl2tpd (Layer 2 Tunneling Protocol (L2TP) daemon)

# apt-get install xl2tpd

or

# dpkg -i xl2tpd*.deb

/etc/xl2tpd/xl2tpd.conf

[global]
 access control = yes

[lac corbina]
 lns = tp.internet.beeline.ru
 redial = yes
 redial timeout = 1
 require chap = yes
 require authentication = no
 name = 0892993954
 ppp debug = yes
 pppoptfile = /etc/ppp/options.xl2tpd
 require pap = no
 autodial = yes
 tunnel rws = 8
 tx bps = 100000000

/etc/ppp/options.xl2tpd

unit 0
name 0892993954
remotename l2tp
ipparam beeline
connect /bin/true
nodeflate
nobsdcomp
persist
holdoff 10
maxfail 0
nopcomp
noauth
noaccomp
defaultroute


/etc/ppp/ip-up.d/beeline

#!/bin/sh

#get default gw ip
BEELINEGWIP=`route -n | grep 'UG[ \t]' | awk '{print $2}' | tail -n 1`

#get and set routes for BEELINE DNS servers
DNS1=`grep nameserver /etc/resolv.conf | awk '{print $2}' | head -n 1`
DNS2=`grep nameserver /etc/resolv.conf | awk '{print $2}' | tail -n 1`

if [ "$DNS1" != "$DNS2" ]; then
 ip route add $DNS1 via $BEELINEGWIP
 ip route add $DNS2 via $BEELINEGWIP
else
 ip route add $DNS1 via $BEELINEGWIP
fi

#get ips for tp.internet.beeline.ru, if going to loop comment elif 
while true; do
 IPS=`host tp.internet.beeline.ru | awk '{print $4}' | cut -d. -f1,2,3 | sort -u`
 for IP in $IPS
 do
  if [ "$IP1" == "" ]; then
   IP1=$IP
  elif [ "$IP1" != "$IP" ] ; then
   IP2=$IP
   break 2
  fi
 done
 sleep 1
done

#set routes for l2tp tunnel 
if [ "$IP1" != "" ]; then
 ip route add ${IP1}.0/24 via $BEELINEGWIP
fi
if [ "$IP2" != "" ]; then
 ip route add ${IP2}.0/24 via $BEELINEGWIP
fi

#remove default routes 
ip route del default
ip route del $5 dev $1