#1
  1. watch for flying fingers
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2003
    Location
    Rocket City, USA
    Posts
    819
    Rep Power
    378

    Restarting network devices remotely


    I have a machine with several IP addresses with eth devices like eth0, eth0:1, eth0:2, eth0:3. Can I restart only eth0 without bringing down eth0:1? It would be really convenient to be able to log in via SSH on eth0:1 and restart eth0 without locking myself out or not being able to bring the network back up.

    If I stop eth0, will that automatically stop all the others?
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    I suppose you can use ifconfig to restart a specific network interface. When connected remotely via ssh to a Fedora machine I regularly do 'service network restart' without getting kicked off (although that's on my internal LAN not so much to an outside server).
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Minneapolis, MN
    Posts
    356
    Rep Power
    13
    Like Doug said, you should be able to do this with ifconfig. Note that if you re-ip eth0, it might remove your default gateway. Generally, when I don't have serial console access and need to do this type of thing, I start a screen session and just execute a string of commands in it just in case I get dumped.
    Code:
    # ifconfig eth0 1.2.3.4 netmask 255.255.255.0 && route add default gw 1.2.3.255
    If I really want to play it safe, I will actually write out a quick shell script that will make the change, check for connectivity (just a quick ping test) and revert to the previous config if the test fails. If I don't have easy physical access (or serial), I generally play it safe, myself.
    badger badger badger badger
    badger badger badger badger
    MUSHROOM MUSHROOM

IMN logo majestic logo threadwatch logo seochat tools logo