[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Proper way to restart network after modem/router reset



On Sun, Feb 13, 2011 at 11:39 AM, Joe Riel <joer@san.rr.com> wrote:
>
> Occasionally I need reset the external cable modem/router that connects
> our home machines to the internet.   After doing so, I frequently have
> to reboot my machine to establish a connection.  Occasionally I've
> been successful just doing
>
> $ sudo dhclient -r
> $ sudo dhclient
>
> However, that frequently does not work.  When on Ubuntu I occasionally
> was able to succeed with
>
> $ sudo /etc/init.d/networking restart
>
> Trying that on Squeeze gives the warning
>
> Running /etc/init.d/networking restart deprecated because it may
> not enable again some interfaces
>
> Web searching indicate that
>
> $ sudo service networking restart
>
> may be the proper way, however that was unclear.  I haven't tried that
> yet. Is there a recommended method? Is there a Debian howto that
> recommends what should be done?

Assuming that you aren't using NM, "/etc/init.d/networking restart"
and "service networking restart" are the same (as long as you have
"service" installed).

The reason for the warning (which isn't issued if you run "... stop"
then "... start") is that "... restart" (and "... stop" then "...
start") runs "ifdown -a" to bring all interfaces down (in fact, it
runs "ifdown -a --exclude=lo" but it's not documented in either "man
ifup" or "ifup --help", doesn't work when I run it at the cli, and
seems to work when "/etc/init.d/networking stop" is run because lo's
still up) and runs "ifup -a" to bring up all interfaces marked
"auto"/"allow-auto". Therefore interfaces marked "allow-hotplug"
aren't brought back up by the script.

Running "dhclient -r eth0" doesn't work. You have to add either "-lf
..." or "-pf ..." (you can get the paths to those files with "ps -ef |
grep dhc") for the ip address to be released.


Reply to: