This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Midnight IP renewal

Hi!

We have an T-DSL Business ADSL line, that disconnects every 24 hours. Since we are using DynDNS services, we want that disconnect to happen at a time, when noone is using our webservices.

Is it possible to write a cron-job that reconnects at 3:00 for example?

Thanks,
Thorsten


This thread was automatically locked due to age.
Parents
  • What "disconnects"?
    Your DHCP lease terminates?
    pppoe?
  • Oh, I'm sorry! It's a PPPoE-DSL connection.

    I want the script to disconnect the interface and reconnect it afterwards.

    The provider really cuts of our line, so that we have to reconnect. But at this time we get an new IP, what's not that good when providing web services...

    When the script disconnects our line, we can be sure, that there won't be an IP change for the next 24 hours. So during a normal work day, our IP we be the same all the time.

    At the moment, we get a new IP at 14:00. To change this, I'd have to restart the firewall at night. I normally sleep at this time...  [;)]

    But I think, I'm not the only one with this problem, am I?

    Thorsten
  • I'm pretty sure there was a post on this;
    you add a call to a script in cron.

    Do a search and if you don't find it repost here...
  • OK, now I found something:
    https://community.sophos.com/products/unified-threat-management/astaroorg/f/51/t/21081

    But where do I have to put the "killalll pppoe" command? Into the crontab or do I have to create a new script and put it into the cron.daily directory?
  • Best to put it in a script (though I suspect you can do the two commands using a bash && operator; but you might have to include the path to the bash interpreter...); here is a thread where they discuss the editing of cron entries:

    IPSec with bothside dyn. IP´s

    [I'm surprised there wasn't an example at the Astaro Hacker's website]
  • I´m surprised too ;-)

    Maybe they do not know about it... so I will put the esentials of the thread into the Astaro Hacker´s website.

    techno.kid
  • Thanks from us and those yet to come...
  • Can you post a link to that thread?

    And just to put it right:

    I'll then create a script called "crontab.dslreconnect" in /etc with this content:
    0 3 * * *  root /var/chroot-pppoe/etc/ppp/ip-down

    Is this right for the PPPoE to reconnect at 3:00?

    Thanks,
    Thorsten
  • Am I getting this right or am I mistaking???
  • At least the "time" part though I do not know if the pppoe interface will come up automatically after the "down".

    techno.kid
  • At least that's what you wrote on the ASL hacker page:
     How can I reset my DSL/pppoe interface?
  • [ QUOTE ]
    Oh, I'm sorry! It's a PPPoE-DSL connection.

    I want the script to disconnect the interface and reconnect it afterwards.

    The provider really cuts of our line, so that we have to reconnect. But at this time we get an new IP, what's not that good when providing web services...

    When the script disconnects our line, we can be sure, that there won't be an IP change for the next 24 hours. So during a normal work day, our IP we be the same all the time.

    At the moment, we get a new IP at 14:00. To change this, I'd have to restart the firewall at night. I normally sleep at this time...  [;)]

    But I think, I'm not the only one with this problem, am I?

    Thorsten 

    [/ QUOTE ]

    If they disconnect you just decrease the reconnect that astaro uses to redial. No need to add another script as Astaro has one built in for redialing. By default the redial time is 15 minutes.  The mods below make it 60 seconds. I have changed it as follows:
    If you are using pppoe (ie DSL) to connect to the net and you reset your modem Astaro takes 15 minutes to reconnect. I traced this to the DSL.sh file in /var/chroot-pppoe/bin/DSL.sh where the timeouts are set to 900 seconds. These to me seem to be way too high. I changed mine as follows:


    Code:


    # timeouts in seconds
    MINTIME=60
    ACRETRY=10
    PPPOERETRY=60
Reply
  • [ QUOTE ]
    Oh, I'm sorry! It's a PPPoE-DSL connection.

    I want the script to disconnect the interface and reconnect it afterwards.

    The provider really cuts of our line, so that we have to reconnect. But at this time we get an new IP, what's not that good when providing web services...

    When the script disconnects our line, we can be sure, that there won't be an IP change for the next 24 hours. So during a normal work day, our IP we be the same all the time.

    At the moment, we get a new IP at 14:00. To change this, I'd have to restart the firewall at night. I normally sleep at this time...  [;)]

    But I think, I'm not the only one with this problem, am I?

    Thorsten 

    [/ QUOTE ]

    If they disconnect you just decrease the reconnect that astaro uses to redial. No need to add another script as Astaro has one built in for redialing. By default the redial time is 15 minutes.  The mods below make it 60 seconds. I have changed it as follows:
    If you are using pppoe (ie DSL) to connect to the net and you reset your modem Astaro takes 15 minutes to reconnect. I traced this to the DSL.sh file in /var/chroot-pppoe/bin/DSL.sh where the timeouts are set to 900 seconds. These to me seem to be way too high. I changed mine as follows:


    Code:


    # timeouts in seconds
    MINTIME=60
    ACRETRY=10
    PPPOERETRY=60
Children
  • OK, since you guys do not seem to get my point, I created the ""crontab.dslreconnect" file as mentioned above and modified the "DSL.sh" file according to your values. I'll then check the PPPOE logfiles and tell you, what happened...
  • Hi THoehne,

    that would be great - I then will "put" this all together at the aslhackers faq.
    Besides: you are right - in fact I did write about the pppoe down script but forgot it :-)

    techno.kid
  • [ QUOTE ]
    OK, since you guys do not seem to get my point, I created the ""crontab.dslreconnect" file as mentioned above and modified the "DSL.sh" file according to your values. I'll then check the PPPOE logfiles and tell you, what happened... 

    [/ QUOTE ]

    I got your point.  What i was saying is that since you get booted every night at midnight..ASL 5 should sense that on its own and automatically redial.  No need to add another script to shutdown pppoe.  I can simulate the same thing but simply turning off my dsl modem.  I then turn it back on and i watch ASL figure out the connection went down and it redials within 60 seconds.  ASL 5 does hte magic on its own without ht need for an additional hacked script.  Also the dyndns will automaticlaly update itself at the time you reconnect.  I use the dyndns of ASL as well.  Again i can power down the modem, power it back up and by the time my dsl modem synchs back up ASL is already redialing the connection and reupdating dyndns.  
  • The problem is, my line isn't disconnected every midnight. It disconnects every 24 hours! So when I do an reboot e.g. because of an Up2Date packet at 10:00, I get a new IP avery day at 10:00!
    But I don't want to get a new IP every day at 10:00 when normal work is in progress. I want the disconnect happen at night! So I have to force a disconnect at night, that I get a new IP when nobody's in the office.
    You understand my problem?
  • [ QUOTE ]
    The problem is, my line isn't disconnected every midnight. It disconnects every 24 hours! So when I do an reboot e.g. because of an Up2Date packet at 10:00, I get a new IP avery day at 10:00!
    But I don't want to get a new IP every day at 10:00 when normal work is in progress. I want the disconnect happen at night! So I have to force a disconnect at night, that I get a new IP when nobody's in the office.
    You understand my problem? 

    [/ QUOTE ]

    Yes but it is not a problem.  The transistion would be hardly noticeable.  What i would do instead of hacking the box.  Stay late one night and force a reboot(or login remotly from home via webadmin) and force a reboot.  That would reset your timer..then everything would take place during the time you want it to.  

  • That is the way I used to do it. But since I do not want to stay up late just to reboot a company's machine, I'd prefer to do a skript.

    Furthermore my VPN access into our LAN doesn't work anymore from my home PC and those M$ suckers won't help me resolve it...  

    I could sleep better at night with this skript!  [;)]
  • [ QUOTE ]
    That is the way I used to do it. But since I do not want to stay up late just to reboot a company's machine, I'd prefer to do a skript.

    Furthermore my VPN access into our LAN doesn't work anymore from my home PC and those M$ suckers won't help me resolve it...  

    I could sleep better at night with this skript!  [;)] 

    [/ QUOTE ]

    Well if they truly disconnect you every 24 hours..you should only ahve to reboot once no?..
  • That would be right, if our provider didn't disconnect from time to time...  
  • Hi guys,

    to shorten this threat and looking forward to a solution I suggest THoehne is doing the testing of his cronjob and providing us the result - I´m positive that it will work like supposed to... 3:00 AM disconnection and a reconnection about 60 seconds later...

    techno.kid