I am connecting to my internet provider through PPPoE connection
provider assigns me IP dynamically
but provider sometimes assigns private IP (10.x.x.x) instead of public
(I mean that my provider assigns randomly private or public IP)
here is my question
how can I configure openwrt to renew connection automatically if private IP is assigned ??
I mean after connection established provider assigned me IP
openwrt checks that IP
if IP is private
openwrt closes connection (or reboots openwrt)
waits few minutes connects to provider again
until public IP is not assigned by provider
I think it is better to talk with your provider first. Explain them your situation and see what they have to say.
What if they don't allocate you a public IP for a long time?
ip a show $IFACE | grep -q 'inet 10\.' && do-something-to-restart-this-interface
in if-up.d or as you mention something similar in /etc/ppp/ip-up if that's getting called on your system.
other forum user tried to help me with this generic linux script
but most important for me is do-something-to-restart-this-interface
so what I can write in /etc/ppp/ip-up to restart(reinitialize) that pppoe connection to get new IP
also man pppd says
/etc/ppp/ip-up
A program or script that is executed when the link is available for sending and receiving IP packets (that is, IPCP has come up). It is executed with six command-line arguments: interface-name tty-device speed local-IP-address remote-IP-address ipparam.
I assume assigned IP address should be $4 (local-IP-address)
===============
currently I read book The Linux Command Line W. Shotts
what you think this will help me to understand what is going on on this script??
Using the network function library, we dynamically fetch network parameters from the runtime configuration, and with hotplug we catch the moment when the WAN interface becomes ready.
PPP-related scripts operate at a lower level than network hotplug scripts.
I'm not really familiar with the former and I'm not sure if a single PPP session is enough to assign the required address, so the first line of the script saves it to the /etc/hotplug.d/iface/10-fix-wan-ip.