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?

  • 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! – Celada Jan 23 '15 at 5:15
  • On what distribution? – Gilles Jan 23 '15 at 23:11
  • @Gilles, Ubuntu server 14.04.1, GNU/Linux 3.13.0-35-generic x86-64 – Cam Jones Jan 24 '15 at 2:01

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).

  • 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. – Cam Jones Jan 23 '15 at 9:39
  • If you use the service network restart you gonna be probably disconnected. I think the restart can take place of ifdown and ifup. – Aragmond Jan 23 '15 at 9:52
  • 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). – Cam Jones Jan 24 '15 at 1:59
  • Yea I think you can login back when you use this command. But I had never try this. – Aragmond Jan 26 '15 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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