Service network restart same as ifup and ifdown?

8,864

Yea you would be disconnected. Like Celada say "Connecting to the console is the only safe way!". You can try this and if you can't reconnect with ssh, you can go to your console.

But if you use the command:

ifdown <interface-name> && ifup <interface-name> 

I think that's gonna be worked (But you gonna be disconnect).

Share:
8,864

Related videos on Youtube

Cam Jones
Author by

Cam Jones

Updated on September 18, 2022

Comments

  • Cam Jones
    Cam Jones almost 2 years

    Can service network restart take place of ifdown and ifup?

    I was managing my server the other day using SSH and I changed my internal IP from DHCP to static. After editing the config file I had to restart the network to update the config. I didn't want to try doing ifdown from SSH because I'm sure I would be disconnected. I wasn't sure of any other commands at the time so I just hardwired into the server and finished the maintenance from there. Afterwords I found out about the service network restart command. If I had done that command instead from SSH, would I have been able to log back in afterwards using SSH?

    • Celada
      Celada over 9 years
      I generally use ifdown <interface-name> && ifup <interface-name> but you're right: you lose access if anything goes wrong. Connecting to the console is the only safe way!
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' over 9 years
      On what distribution?
  • Cam Jones
    Cam Jones over 9 years
    That is why I want to know if service network restart can take place of ifdown and ifup. If the network service is restarted instead of just going down then I could do network maintenance over SSH.
  • Aragmond
    Aragmond over 9 years
    If you use the service network restart you gonna be probably disconnected. I think the restart can take place of ifdown and ifup.
  • Cam Jones
    Cam Jones over 9 years
    Yes but being disconnected isn't a problem as long as <interface-name> restarts instead of just doing down, at least that is what my theory is. Even though the SSH tunnel would be disconnected I could just redo the SSH command and log back in(I hope).
  • Aragmond
    Aragmond over 9 years
    Yea I think you can login back when you use this command. But I had never try this.
  • kamil
    kamil over 3 years
    this won't work in some cases, because there is a wait time that should be held between ifdown and ifup
  • Daniel F
    Daniel F about 3 years
    You could issue this command inside of gnu screen, that way you would be sure that ifup will also get executed