Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my raspberry hooked up via ethernet to a printer.

So what happens is the raspberry takes about 4 mins to get itself ready as a sort of server, and by that time the printer gives up trying to connect. I've set the PI to be a DHCP server so the printer gets that early (within 30 seconds of getting power).

So after 4 mins is there a way I can disconnect the ethernet port and have it reconnect, so to the printer attempts to connect itself once it notices the ethernet cable was plugged in.

At the moment after 4 minutes, I manually remove the ethernet cable and plug it back in and alls ok. Is there a way I can do this via commands, to temporarily switch off the ethernet and reconnect it?

share|improve this question
That is a very interesting question. But the solution should be to keep your Raspberry booted up and stable so I is always ready to serve its clients. 4 Minutes is a bit long to boot? Have you tried possibly taking the interface down ifconfig eth0 down and then up ifconfig eth0 up? But that is really bad! What if somebody is copying files- then they get booted off. There must be another, more elegant solution to your problem. – ppumkin Jan 24 '13 at 11:14
I also encourage you to find a root cause for that four minute boot time. It shouldn't normally be so. More likely it should be ready in that same 30 seconds or so. – grassroot Jan 24 '13 at 11:45
Its a bit more, so it boots in roughly 30 secs, but various services have to switch on, it has to dial out via a usb modem, it ends up at about 4 mins to be fully ready. I tried ifconfig eth0 down and up but it seems to ignore me on the network then (no DHCP service, even with a static ip ping theres no route to host. I settled on using 2 min DHCP leases but thats not a very good solution – Akshat Jan 24 '13 at 12:19
So why does the printer have to wait for the Pi to dial out. If the Pi boots in 30seconds and DHCP is availabe in 30 seconds. Then what is the printer waiting for again? Wait I re read the question. You have the Pi Ethernet connected directly to the Printer? Or the Printer is USB connected to the Pi and Ethernet to Switch? Not sure. Please make photo or diagram cause I am lost now :) – ppumkin Jan 24 '13 at 13:44

Strictly answering your question, assuming you have raspbian, the "official" distribution:
invoke-rc.d isc-dhcp-server stop ; ifdown eth0 ; sleep 4m ; ifup eth0 && invoke-rc.d isc-dhcp-server start
ifup/ifdown are debian programs that configure the interface through /etc/network/interfaces.

share|improve this answer
SO he can run ifup or ifdown is that what you are saying? – ppumkin Jan 24 '13 at 13:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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