Beeline internet Ubuntu Linux
Внешний вид
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 = login 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 login remotename l2tp ipparam beeline connect /bin/true nodeflate nobsdcomp persist holdoff 10 maxfail 0 nopcomp noauth noaccomp defaultroute
/etc/ppp/chap-secrets
login l2tp password
/etc/ppp/ip-up.d/beeline
#!/bin/bash
echo "Starting...."
#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
echo "ip route add $DNS1 via $BEELINEGWIP"
ip route add $DNS2 via $BEELINEGWIP
echo "ip route add $DNS2 via $BEELINEGWIP"
else
ip route add $DNS1 via $BEELINEGWIP
fi
#get ips for tp.internet.beeline.ru. it`s try get all ip for tp.internet.beeline.ru 20 time with 1 second sleep
count=0
while true; do
if [ $count -eq 20 ]; then
break
fi
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
count=$(( $count+1 ))
sleep 1
done
echo "IP1: $IP1 IP2: $IP2"
#set routes for l2tp tunnel
if [ "$IP1" != "" ]; then
ip route add ${IP1}.0/24 via $BEELINEGWIP
echo "ip route add ${IP1}.0/24 via $BEELINEGWIP"
fi
if [ "$IP2" != "" ]; then
ip route add ${IP2}.0/24 via $BEELINEGWIP
echo "ip route add ${IP2}.0/24 via $BEELINEGWIP"
fi
#add default route
ip route del default
echo "ip route del default"
ip route add default dev $PPP_IFACE
echo "ip route add default dev $PPP_IFACE"
ip route del $5 dev $1
echo "ip route del $5 dev $1"