0

I am connected to ISP using "IPoE" authentification.

It works this way. When a new network device is connected, it gets a local IP address (100.x.x.x) with 10 min lease, and there web authorization is required with user name and password.

After a successful authorization the router gets an internet IP with also a 10 min. lease.

When access to internet is closed, i.g. because a bill has not be paid, the wan interface gets back a 100.x.x.x. address. The access is only to internal resources.

I want to catch this kind of events by a script. It is quite easy to catch ifup or ifdown events in hotplug.d, but there is a problem.

In some cases when there is a problem on ISP side the lease expire, but the new address is not granted. WAN interface stays up, but without any address.

I get a log message

daemon.notice netifd: wan (1019): Lease lost, entering init state

What is a way to catch this event other that just parse logs?

3
  • Are you trying to catch this internally on the router or externally from a device? If it is internal, you could check whether the Wan address starts with 100. if it is the same IP Address you could ping it directly and respond on a reply – Michael B Nov 1 '15 at 14:19
  • I try it internally. I really plan to check the IP, but first I need to catch a lease lost event. I do not want to check the IP by cron or a persistent script. – Pilot6 Nov 1 '15 at 14:51
  • I'm not near an openwrt router to confirm this, but there, and I can't find a reference to it on chaos calmer - however, on older routers there was a file for configuring the dhclient that had a dhcclient-exit-hook that you could put a script in. It might be a place to start... – Michael B Nov 1 '15 at 15:42
0

I found a solution.

Busybox dhcp client calls deconfig_interface() in /lib/netifd/dhcp.script in case of renew timeout.

I can add some call of a script there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.