Putting a network interface up/down from command line

1,327

Solution 1

I think that ifconfig is not handling wireless stuff like ESSID, channel and key. Take a look to iwconfig instead.

http://manpages.ubuntu.com/manpages/vivid/en/man8/iwconfig.8.html

-EDIT-

You can also use "NetworkManager command line" nmcli: https://askubuntu.com/questions/461825/connect-to-wifi-from-command-line

Solution 2

1) This answer is only for a wired connection. Use ifup and ifdown, not ifconfig, unless you want to manually specify the parameters. ifup will look at your network configuration in /etc/network/interfaces (or wherever your distro puts it).

2) If you're using wpa for your wifi, you cannot connect to it with just ifup; a helper application must be configured and running (usually wpa_supplicant). Usually your distro will provide you with network scripts to perform these tasks automatically.

Share:
1,327

Related videos on Youtube

Arron Cao
Author by

Arron Cao

Updated on September 18, 2022

Comments

  • Arron Cao
    Arron Cao over 1 year

    I can not delete this directory admin when under the root permission. Can anyone help? This is mainly due to the improper uninstall of the Vesta control panel. And the file attributes are shown here:

    -------------e- admin/conf/mail 
    
    -------------e- admin/conf/web
    
    -------------e- admin/conf/dns
    

    and the attributes for directory admin are:

    ----i--------e- admin/conf
    
    • durbnpoisn
      durbnpoisn over 9 years
      If the folder cannot be removed, it may be locked for some other reason than permissions. Like, it might still be in use. You could try booting up under some other version of Linux (like a live USB or something), and delete the folder that way. Of course, that might cause errors later. But at least you'll know what's going on.
  • Arron Cao
    Arron Cao over 9 years
    This helps change the file attribute to: drwxr-x--x 2 root root but I still cannot delete the file even under root
  • BowPark
    BowPark over 8 years
    thanks, but can you provide some example about deactivating and reactivating the wireless card? After reading the original manual (the one you provided is in Italian!) I did not find such an example.
  • BowPark
    BowPark over 8 years
    Ok, yes I use WPA very often. So a configuration is needed to be set up when the interface turns up again, which makes the re-connection a non-trivial task?
  • sgargel
    sgargel about 8 years
    If using WPA take also a look to wpasupplicant. A search to "ubuntu WPA wifi command line" will give you many links like: ubuntuforums.org/showthread.php?t=1798927 askubuntu.com/questions/461825/…
  • BowPark
    BowPark about 8 years
    with the second link I succeded to correctly shut down and then put up the interface. Maybe you can include it in your answer, and I will choose it.