Service network restart same as ifup and ifdown?
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).
Related videos on Youtube
![Cam Jones](https://i.stack.imgur.com/ppReV.jpg?s=256&g=1)
Cam Jones
Updated on September 18, 2022Comments
-
Cam Jones almost 2 years
Can
service network restart
take place ofifdown
andifup
?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 theservice 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 over 9 yearsI 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' over 9 yearsOn what distribution?
-
-
Cam Jones over 9 yearsThat 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 over 9 yearsIf you use the service network restart you gonna be probably disconnected. I think the restart can take place of ifdown and ifup.
-
Cam Jones over 9 yearsYes 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 over 9 yearsYea I think you can login back when you use this command. But I had never try this.
-
kamil over 3 yearsthis won't work in some cases, because there is a wait time that should be held between ifdown and ifup
-
Daniel F about 3 yearsYou could issue this command inside of gnu screen, that way you would be sure that
ifup
will also get executed