Ubuntu: how do I refresh my wired ethernet connection from command line?


What is the command line equivalent of unchecking "Enable Networking" (disabling networking) and then re-enabling?

In my environment, there are multiple networks which require me to physically move my network cable. Sometimes my connection does not refresh properly, so I disable/re-enable networking to refresh my connection. Being able to do this from the command line would be much more efficient for me.

I'm using 12.04 LTS.


I'd use the nmcli commands for that purpose:

nmcli nm enable false && nmcli nm enable true  

man page:

DESCRIPTION         nmcli is a command‐line tool for controlling NetworkManager and report‐         ing on its status.  It is not meant as a full replacement for nm‐applet         or other similar clients but as a complementary utility to those pro‐         grams.  The main usage for nmcli is on servers, headless machines or         for power users who prefer the command line.           [...]      nm     NetworkManager            Use this object to inquire and change state of NetworkManager.             [...]              enable [true|false]                   Get networking‐enabled status or enable/disable network‐                   ing by NetworkManager.  All interfaces managed by Net‐                   workManager are deactivated when networking has been dis‐                   abled.                   Reference to D‐Bus:                   interface: org.freedesktop.NetworkManager                   method:    Enable                   arguments: TRUE or FALSE  


Please try:

sudo service network-manager restart  


You could try ifdown and ifup to disable and then enable the interface. Assiming the name is eth0:

sudo ifdown eth0  sudo ifup eth0  

If the problem is reassigning an IP to the interface and you don't want to bring it down completely, you can just request a new one with dhclient:

sudo dhclient eth0  


Best commands in my opinion:

They disables network manager off and on. It is an exact equivalent of unchecking enable networking, and re-checking it to regain connectivity.-

nmcli networking off hitenter

enter image description here

nmcli networking on hit enter

enter image description here

Hope this helps.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »