Help us enhance your Sophos Community experience. Share your thoughts in our Sophos Community survey.

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
  • 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

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • 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.  

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • 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.  

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • 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?..

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

Reply
  • [ 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?..

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

Children
  • 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
  • Hi THoehne,

    my proposal is not touching the firewall. 
    Why don't you buy a cheep digital switching clock and power off your dsl-modem at your given time for 1 minute. As soon, as your modem is up again ASL will reconnect and you will have a new ip-address for the next 24 hours.
  • [ QUOTE ]
    Hi THoehne,

    my proposal is not touching the firewall. 
    Why don't you buy a cheep digital switching clock and power off your dsl-modem at your given time for 1 minute. As soon, as your modem is up again ASL will reconnect and you will have a new ip-address for the next 24 hours. 

    [/ QUOTE ]

    Hey...that's an excellent idea!..

    I would still change the reconnect timeout from 15 minutes to 60 seconds..but if you wnted to have a 'pure" firewall yes don't mess with it at all and use the clock..the untimate KISS solution..

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • OK, strange result.

    I had a chat with the Astaro Support and they told me, that the  ip-down script is called after the connection has been disconnected. It's not the script that disconnects the PPPOE line at all. They proposed me to change the status of the connection in the /etc/wfe/conf/itf.conf file from 1 to 0 and back to bring up the interface again.

    Nevertheless I sticked to my plan...

    And voilá: DynDns.org tells me, that our IP got updated this night! But at 4:20...
  • Hi, I have the same problem mentioned here.

    I have tested both solutions, kill the pppoe-process via cron, and disconnect pppoe by changing the interface-status parameter in itf.conf.

    Using the kill-command brings up "middleware not running"-mails every day. In the past I did not get those mails, why?

    Changing the parameter in itf.conf works fine, but I don't know how to integrate it in crontab. Any hints?

    Besides that I want to know why all pptp-connections are killed when I disconnect my pppoe with one of the method mentioned above???
  • For all the ASL users in Germany with the same problem: ALDI Sued offers a digital switching clock on 24th February for 3,99 EUR. 

    Ip-Down solution doesn't seem to work out well...
  • So here is my solution:

    create a crontab.reconnect file under /etc with

    0 5 * * *       root    kill -1 `ps -x | grep "/usr/sbin/pppoe" | grep -v "/usr/sbin/pppd-pppoe call" | awk '{print $1}'`

    and reboot. That worked for me, my pppoe reconnects every night at 5 o'clock without any problems.
  • Since this solution works for me :-) I will add it to the ASL Hackers FAQ

    techno.kid