Arduino uno over internet

Hello everyone,

I have an Arduino uno with Ethernet shield, and a 5V relay used to start and stop over the internet an electric boiler 200L.
Arduino is connected to a router (second router) who is connected in the repetitive mode with the router (first router) from the internet provider.
My problem is when, the internet connection from the first router is down, the relay board enter in a on/off continuous mode until the internet connection in established again.
Can anyone help me with a solution? I want when is no internet connection the relay board goes in off mode, and wait until the internet connection is on again, and take the last command from the website.

PS: sorry for my English.
Thanks

Post the code that you have running on the Arduino.