LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2024, 01:16 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post A question about bringing down the network card


Hello,
Why do some services not work when I bring down a NIC and bring it up again and I have to restart the network service?

Thank you.
 
Old 02-05-2024, 03:18 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
would be nice to give use more details.
 
Old 02-05-2024, 08:25 AM   #3
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by pan64 View Post
would be nice to give use more details.
Hello,
Thank you so much for your reply.
I bring down a NIC and bring it up again, but the v2ray service didn't work until I restart the network service.
 
Old 02-05-2024, 10:09 AM   #4
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 779

Rep: Reputation: 246Reputation: 246Reputation: 246
I'm not familiar with v2ray, but likely once it sees there's no network to use it drops off. Restarting the network likely restarts all services that depend on it. This would be up to your init system. Personally, I don't see the reason to stop the network itself unless it's shutdown time for the machine.
 
Old 02-05-2024, 10:52 AM   #5
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by jayjwa View Post
I'm not familiar with v2ray, but likely once it sees there's no network to use it drops off. Restarting the network likely restarts all services that depend on it. This would be up to your init system. Personally, I don't see the reason to stop the network itself unless it's shutdown time for the machine.
Hello,
Thank you so much for your reply.
Do you think the same might happen to other services like Apache?
 
Old 02-06-2024, 08:56 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I'm with jayjwa...

Basically, restarting the Network svc is usually a last resort (unless you're shutting down / rebooting the box).

Attempt to fix whatever svc is having an issue, inc restarting the svc if needed.

Ofc any svc that is network dependent is going to fail if you yank the network out from under it.. unless it's a very quick restart, in which case it might(!) be able to recover.
However, that's a case-by-case thing.
 
Old 02-06-2024, 10:32 PM   #7
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Another thing to consider, especially if using dhcp

There are times when taking a network interface down and back up may give it a new IP.

Any service that has an active connection at the time the card is taken down will have that connection broken by taking the interface down.
Bringing it back up does not restore those connections The service is left with a connection that was interrupted and is waiting for the other end to reply or respond but there is no longer a complete connection so it hangs.

This is just the way services that use tcp work -- an active connection that is broken remains broken -- so if you have need to disable the network you should first stop all services that use the network.
 
1 members found this post helpful.
Old 02-07-2024, 05:18 AM   #8
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by computersavvy View Post
Another thing to consider, especially if using dhcp

There are times when taking a network interface down and back up may give it a new IP.

Any service that has an active connection at the time the card is taken down will have that connection broken by taking the interface down.
Bringing it back up does not restore those connections The service is left with a connection that was interrupted and is waiting for the other end to reply or respond but there is no longer a complete connection so it hangs.

This is just the way services that use tcp work -- an active connection that is broken remains broken -- so if you have need to disable the network you should first stop all services that use the network.
Hello,
Thank you so much for your reply.
So if we stop the Apache service and run it again, then people have to refresh the website!
How about the UDP protocol?
 
Old 02-07-2024, 08:24 AM   #9
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by Jason.nix View Post
Hello,
Thank you so much for your reply.
So if we stop the Apache service and run it again, then people have to refresh the website!
How about the UDP protocol?
If you bring down the network interface they have to reconnect.
If you stop apache and restart it they have to reconnect.
Both those are from the client end.

From the server end:
If apache has an active connection it may stall when the interface is removed but does not stall when it is stopped and restarted.
Rebooting a system brings services down in an orderly manner and restarts them the same way.
Downing a network interface while the service is running is a sudden disorderly disconnect and can have unanticipated results.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Will bringing down the loopback interface make the whole server to go down? siranjeevi Linux - Networking 5 12-14-2010 02:03 PM
system locks up when bringing down bonded network interface BrianK Linux - Hardware 1 02-20-2007 10:09 PM
linux shuts down built in network card then windows tells me network card is unplugge lesmoxhaybaker SUSE / openSUSE 8 08-29-2006 05:10 PM
FC3 fails in bringing up or down interface eth0, network unreachable a_cmmn Linux - Networking 4 03-10-2005 04:10 PM
suse 8.2 - ? regarding bringing up and down the GUI t3___ Linux - Newbie 4 01-13-2004 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration