-   Linux - Networking (
-   -   Connecting after booting without LAN present (

basjoosten 07-23-2006 05:42 AM

Connecting after booting without LAN present
Hi, I'm using Debian linux and a LAN with a DHCP server. When I startup with the LAN cable in the PC, the connection (to the network) is setup correctly. If I startup first and put the network cable in the PC after booting, the connection is not setup. How can I reinitialize the network connection? What process / program / daemon / service do I need to start? Can I put this process in a CRON job to keep checking for a network connection automatically, or will this keep resetting my connection when it's already present?

Micro420 07-23-2006 12:35 PM

In the command line, do this:


ifconfig eth0 down
/etc/rc.d/network restart
ifconfig eth0 up

This is assuming eth0 is the network card you have in question.

I suppose at this point, you could create a script and add it to your cron jobs to run every XXX seconds. THe only problem is that if your connection is going, it will disconnect you and then reconnect you. :(

I don't know why your computer won't know when the cable is plugged and unplugged. It should know immediately and assign itself an IP address. Odd!!!!!!!!!!!!!!!!!

Matir 07-23-2006 12:48 PM

ifplugd can be used to detect the connecting of an ethernet cable and to automatically setup the network connection at that time.

jvil 08-03-2006 02:39 PM

I have noted the same problem on the three distributions that I have tried so far (Mandrake, Debian and SUSE) so maybe it is a general problem.

I would think that the OS should be able to detect the connection (I would call it a bug).

peter_robb 08-03-2006 03:50 PM

Networking hotplug detects adding or removing hardware, rather than cables/hubs being present/powered.

This would only be a problem if the eth uses dhcp, as a static assignment can be made whether there's a cable or not. Some systems check the cable before bringing an interface up to avoid having dead gateways in the routing table.

If this cable yes/no condition is common, as Matir suggested go for ifplugd.

All times are GMT -5. The time now is 12:07 AM.