Yalo
    e-mail
    internet accelerators
    internet access
    internet and phone call
    web hosting
    storage space
    url redirection
    internet call waiting
    free sms
    nota bene
 

How to configure a tunnel on PPPoE connection with dynamic IP

 

Requisites

Location A) Cisco 851. CiscoIOS version 12.4. PPPoE connection to internet with dynamic IP

Location B) Linux (Slackware). Internet connection with a stable IP

Problem to resolve: it is desired to make a GRE tunnel between Cisco and Linux

Possible solution: IP changes on Cisco are tracked by SNMP and reported (by traps) to SNMP daemon on Linux which updates tunnel with new IP

Cisco end configuration (configuration commands related to our problem showed only)


show conf 
!
vpdn-group 1
 request-dialin
  protocol pppoe
 l2tp tunnel receive-window 128
!
!
!
interface Tunnel1
 ip address 10.10.10.1 255.255.255.252
 tunnel source Dialer1
 tunnel destination 193.193.193.1
!
!
interface FastEthernet4
 no ip address
 ip virtual-reassembly
 duplex auto
 speed auto
 pppoe enable group 1
 pppoe-client dial-pool-number 1
!
interface Vlan1
 ip address 10.10.10.1 255.255.255.248
 ip nat inside
 ip virtual-reassembly
 ip tcp adjust-mss 1452
!
!
interface Dialer1
 ip address negotiated
 ip mtu 1492
 ip nat outside
 ip virtual-reassembly
 encapsulation ppp
 ip tcp adjust-mss 1452
 no ip mroute-cache
 dialer pool 1
 dialer-group 1
 no keepalive
 no cdp enable
 ppp authentication chap callin
 ppp chap hostname USERNAME
 ppp chap password 7 ENCRYPTEDPASSWORD
 ppp pap sent-username USERNAME password 7 ENCRYPTEDPASSWORD
 no ppp pap wait
 ppp ipcp dns request
!
ip route 0.0.0.0 0.0.0.0 Dialer1 permanent
ip route 10.0.2.0 255.255.255.0 Tunnel1
!
ip nat inside source list 101 interface Dialer1 overload
!
access-list 101 permit ip 10.10.10.0 0.0.0.255 any
snmp-server enable traps snmp linkup
snmp-server host 193.193.193.1 version 2c SnmpTrap
!

Linux end configuration

# cat /etc/snmp/snmptrapd.conf
pidFile /var/run/snmptrapd.pid
logOption f /var/log/snmpdtraps.log
authCommunity log,execute ciscotrap
traphandle IF-MIB::linkUp /etc/snmp/traphandle

# cat /etc/snmp/traphandle 
#!/bin/sh

while read <&0
do
awk '$1 ~ "UDP:" {split ($2, A, "["); split (A[2], B, "]"); print B[1] }'
done | /etc/rc.d/rc.tun restart

# cat /etc/rc.d/rc.tun
#/bin/sh

local=193.193.193.1

tun_stop () {
ip link set my_tunnel down ;
ip tunnel del my_tunnel ;
}

tun_start () {
read IP <&0
ip tunnel add my_tunnel mode gre remote $IP local $local ttl 255 ;
ip addr add 10.10.10.2/30 dev my_tunnel ;
ip link set dev my_tunnel up ;
ip route add 10.0.1.0/24 dev my_tunnel;
}


case $1 in
'stop')
tun_stop;
;;
'start')
tun_start;
;;
'restart')
tun_stop;
tun_start;
;;
esac

# snmptrapd -c /etc/snmp/snmptrapd.conf

# snmptrapd -v

NET-SNMP Version:  5.4