# Automatic reconnect after IP expires with ppp?



## plus (Aug 14, 2009)

Hi, is there any way to have ppp automatically renegotiate for a new IP address when my ISP decides my IP has expired?  Presently, whenever this happens I lose my internet connection until I manually stop ppp, destroy the tun device, and restart ppp.  I tried putting ``enable lqr'' in my ppp.conf, but that just caused a whole bunch of breakage - specifically, it caused my network connection to completely go out every minute for about three minutes at a time.  My ISP is qwest and the relevant parts of my ppp.conf follows.

```
<snip>

default:
 set log Phase tun command
 set redial 15 2500
 set reconnect 5 2500
# enable lqr
# ident user-ppp VERSION (built COMPILATIONDATE)
# set ifaddr 10.0.0.1/0 10.0.0.2/0

<snip>

qwest:
  set device PPPoE:re0
  set authname <censored>
  set authkey <censored>
  set dial
  set login
  add default HISADDR
```

Other information: re0 is the connection to the modem and re1 is LAN-facing, and bridged with tap0 (the VPN device) into bridge0. The IP address is 10.0.24.1 and the LAN block is 10.0.24.0/24, but is on a VPN that uses the whole 10.0.0.0/8 block.  The FreeBSD box runs BIND and grabs info from OpenDNS.  I also use PF as a firewall.

Let me know if any other information would be helpful.


----------



## aragon (Aug 15, 2009)

You can try add "enable echo" to your config.  That uses LCP echos rather than LQR which is often better supported by ISPs.

If that doesn't work either, well, then I suggest you switch ISPs because it sounds like yours is very broken.  Only alternative I can think of is to write a crontab that performs an ICMP ping and reconnects the link when those time out. (see "set server" in ppp(8))


----------



## plus (Aug 15, 2009)

Thanks, I'll try using ``enable echo''.



			
				aragon said:
			
		

> If that doesn't work either, well, then I suggest you switch ISPs because it sounds like yours is very broken.



Well, the thing is I know it CAN work, because previously I used the ultra-cheap modem/router combo (which is now acting in bridged mode as just a modem), and it reacquired an IP address when my old one expired just fine.  All my current outgoing connections were reset, so I could tell when this occurred.

I'm also kind of hoping Qwest will bring fiber to my area .


----------



## aragon (Aug 15, 2009)

Cool.  Let us know how it goes.  If it doesn't work, please post relevant information from ppp.log.


----------



## mickey (Aug 15, 2009)

Using the "ddial" mode of ppp should do the trick. From the manpage:


```
-ddial
  This mode is equivalent to -auto mode except that ppp will bring
  the link back up any time it is dropped for any reason.
```

To enable it, you should put something like the following into your /etc/rc.conf file:


```
ppp_enable="YES"
ppp_profile="<name-of-your-ppp-profile-here>"
ppp_mode="ddial"
ppp_nat="NO"
```


----------



## plus (Sep 21, 2009)

Sorry for bringing this back from the dead, but just wanted to say that mickey's solution worked.  I had it set to ddial in my rc.conf at one point, but I thought it was a typo so I changed it back to ``dial'' once.  After reading mickey's post I changed it back to ddial again, and now everything is working as expected, so this thread can be marked Solved.

Thanks again.


----------

