How to connect and disconnect to a network manually in terminal?Connect to WiFi network through Ubuntu...
Is it possible to grant users sftp access without shell access? If yes, how is it implemented?
Why zero tolerance on nudity in space?
Why exactly do action photographers need high fps burst cameras?
How to play electric guitar and bass as a duet
Can I make estimated tax payments instead of withholding from my paycheck?
Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?
Why is it that Bernie Sanders is always called a "socialist"?
Numbers with a minus sign in a matrix not aligned with the numbers without minus sign
Slow While Loop, Query Improvment Assistance
Graph with overlapping labels
Dilemma of explaining to interviewer that he is the reason for declining second interview
Finding a logistic regression model which can achieve zero error on a training set training data for a binary classification problem with two features
Can you tell from a blurry photo if focus was too close or too far?
Is using an 'empty' metaphor considered bad style?
Why did Luke use his left hand to shoot?
How can I get my players to come to the game session after agreeing to a date?
How old is the day of 24 equal hours?
Am I a Rude Number?
What are "industrial chops"?
Why do neural networks need so many training examples to perform?
Is boss over stepping boundary/micromanaging?
What is the most fuel efficient way out of the Solar System?
What is a good reason for every spaceship to carry a weapon on board?
Making him into a bully (how to show mild violence)
How to connect and disconnect to a network manually in terminal?
Connect to WiFi network through Ubuntu terminalIs there a way to make Ubuntu “forget” a network connection?ubuntu 14.04 connect to a wifi network using command lineConnecting to a wireless networkiwconfig usage for WEP access point?How to Connect/Disconnect to WiFi Via Terminal(Ubuntu Server 14.10) Cannot connect to wirelesshow to connet to hidden network from terminalInstalling Broadcom Wireless DriversHow to fix “The system is running in low-graphics mode” error?Use Network-Manager to connect to a WiFi Access Point on the command-lineConnect/disconnect from VPN from the command lineManually activate Network Manager Applethow to connect to wireless network through terminalHow to disconnect from wireless connection manually using the command line without using network manager?Connect to WiFi network through Ubuntu terminalHow to disconnect from a wireless network in Gnome 3.10How to connect to WiFi from the command line?How to Connect/Disconnect to WiFi Via TerminalHow to connect to a network without having a GUI at any point of time?
Since the network manager is troubling me so much I want to replace it (possibly wicd
orNM
from ppa:volanin).
I do not know how to connect and disconnect to the network through the terminal without using network manager.
I would like a command-line way of managing the network.
wireless command-line network-manager
add a comment |
Since the network manager is troubling me so much I want to replace it (possibly wicd
orNM
from ppa:volanin).
I do not know how to connect and disconnect to the network through the terminal without using network manager.
I would like a command-line way of managing the network.
wireless command-line network-manager
2
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
I usewicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key->
) to set configurations; everything else is obvious from the on-screen instructions.
– isomorphismes
May 19 '15 at 14:43
add a comment |
Since the network manager is troubling me so much I want to replace it (possibly wicd
orNM
from ppa:volanin).
I do not know how to connect and disconnect to the network through the terminal without using network manager.
I would like a command-line way of managing the network.
wireless command-line network-manager
Since the network manager is troubling me so much I want to replace it (possibly wicd
orNM
from ppa:volanin).
I do not know how to connect and disconnect to the network through the terminal without using network manager.
I would like a command-line way of managing the network.
wireless command-line network-manager
wireless command-line network-manager
edited Apr 2 '13 at 20:51
Mateo
7,37484971
7,37484971
asked Dec 7 '10 at 20:59
user7048user7048
546353
546353
2
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
I usewicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key->
) to set configurations; everything else is obvious from the on-screen instructions.
– isomorphismes
May 19 '15 at 14:43
add a comment |
2
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
I usewicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key->
) to set configurations; everything else is obvious from the on-screen instructions.
– isomorphismes
May 19 '15 at 14:43
2
2
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
I use
wicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.– isomorphismes
May 19 '15 at 14:43
I use
wicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.– isomorphismes
May 19 '15 at 14:43
add a comment |
4 Answers
4
active
oldest
votes
This applies to 12.04+ since these are the ones I could test but could also be used in older versions. I have separated this guide into several parts, which consist of:
Part 1 Wireless Routers with no password or WEP Key
Part 2 Wireless Routers with WPA or WPA2 security Key
Part 2.1 Connecting to a WPA Router with wpa_supplicant
Part 2.2 Connecting to a WPA Router with Network Manager
Part 3 Easy Connection Via nmcli
Part 4 Disconnecting from a Wireless Router
Part 5 Deleting a Connection (Including Configuration File)
Part 6 Automatic connection when login in
Bonus How to find your network interface name via GUI
The following command lines can be used to connect and disconnect depending on the Wireless card, wireless security and wireless router settings. Before proceeding, make sure the network service is enabled (For cases where you might start Ubuntu using Recovery mode):
Depending on your Ubuntu Version, you would need to start it using one of the following way:
If using SystemD (since 14.10+):
sudo systemctl start networking
If using the Legacy init.d way: sudo /etc/init.d/networking restart
If using the Legacy Upstart way: sudo service network-manager restart
Part 1: Wireless Routers with no password or WEP Key
For cases where the wireless router has no password or WEP security, do the following:
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option.To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
If it does not have a password do the following:
iwconfig wlan0 essid NAME_OF_ACCESS_POINT
For example
iwconfig wlan0 essid CYREX
after that, make sure to use
dhclient
so you can get a dynamic IP in case you don't get assigned one by the router. That should leave you connected to the CYREX router.
If it has a password then do:
iwconfig wlan0 essid CYREX key PASSWORD
That should connect using the PASSWORD you gave there.
Again, do
dhclient
after connecting to make sure you get an IP assigned.
Making sure you are correctly connected is always good so execute
iwconfig
to make sure your wireless card is connected to the SSID you mentioned above. It should show your device connected and the IP assigned to you. If it does not and gives you an error like Interface doesn't support scanning try the following 2 options:
- Test if your interface is UP:
sudo ifconfig wlan0 up
- Try adding
sudo
when doing the scan:sudo iwlist wlan0 s
Try bringing the device down and then back up:
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
- Test if your interface is UP:
Part 2: Wireless Routers with WPA or WPA2 security Key
For cases where the wireless router has a WPA/WPA2 password there are a few ways of doing this. I will mention the 2 most popular ones::
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option. To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
Part 2.1 WPA-SUPPLICANT GUIDE: Connecting to a WPA Router with wpa_supplicant
Type the following in the terminal (Assuming you have the
wpasupplicant
package installed which installs all the needed commands we will use here):
wpa_passphrase SSID PASSWORD > CONFIG_FILE
Example:
wpa_passphrase Virus LinuxFTW > wpa.conf
Where Virus is the name of my router,LinuxFTW is my password and
wpa.conf
is the file where I want to store all of this information in. Note that you can save the file in another place, many users save the file in/etc/wpa_supplicant.conf
instead ofwpa.conf
. The data of the wpa.conf file should be something like this:
network={
ssid="Virus"
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Up to this point, we should know the name of our wireless card interface (eg: Wlan0, eth2, Wlan2...). We now need to know which Driver is in use. for this we type:
wpa_supplicant
It should show us a lot of information, but there will be a section called **Drivers* which shows all available drivers (These are available when compiling
wpa_supplicant
). In my case it is like this:
drivers:
wext = Linux wireless extensions (generic)
nl80211 = Linux nl80211/cfg80211
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
The whole list is hostap, hermes, madwifi, wext, broadcom, wired, roboswitch, bsd, ndis. This can change depending on how
wpa_supplicant
was compiled, but the one that shows for me should be similar to the one on your system. Most users will select thewext
driver.
So now that we have our wireless interface card name and the driver name, we proceed to connect to it using the already created configuration file using the following format:
wpa_supplicant -iINTERFACE_NAME -cCONFIGURATION_FILE -DDRIVER_NAME
For example:
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Where
-i
is your interface card's name,-c
is where your configuration file is and-D
is the name of the driver you will be using to connect. If it connects correctly, then we press CTRL+C to cancel it and then execute the line again but this time we send it to the background with-B
so we can continue to use the terminal:
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
After that simply do a
sudo dhclient wlan0
to get an IP from the router.
Some users have reported removing the Hash and leaving only the password in the config, for example:
network={
ssid="Virus"
psk="LinuxFTW"
}
Others have added the ssid_scan to the config file:
network={
ssid="Virus"
scan_ssid=1
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Or even adding the Key type:
network={
ssid="Virus"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
More information about this in
man wpa_supplicant.conf
Part 2.2 NETWORK MANAGER GUIDE: Connecting to a WPA Router with Network Manager
The good thing about network manager is that it comes with a couple of nice scripts and tools. Two of these are nmcli
and create_connection
(Neat Python 3 script) which we will use in this case.
After doing the steps mentioned previously to find your router's SSID name (Remember the part about
iwlist
above) we do the following:
sudo /usr/share/checkbox/scripts/create_connection -S SECURITY_TYPE -K PASSWORD SSID_NAME
Where SECURITY is the type of security the Router uses (WPA, WEP), PASSWORD is.. well..the password and SSID_NAME is the SSID Name of the Router. For example:
sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
Will create a connection for Network Manager which should look something like this:
$ sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
[sudo] password for cyrex:
Connection Virus registered
Connection Virus activated.
After this, you should get an IP assigned from the router. If not simply do
sudo dhclient wlan0
(Assuming wlan0 is the name of your interface). You can also check your network manager's connections using nmcli like this:nmcli c
which should show something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Fri 05 Apr 2013 10:04:05 PM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 09 Apr 2013 06:31:10 AM VET
I mention the Network Manager's way because there are a couple of cases where using wpa_supplicant
will simply not work (Problems between router and wireless card, security issues, etc..). In my case, all attempts to use wpa_supplicant
on one PC did not work, but in another it worked the first time I tried. So am posting both methods to help on each case and to make it easier for users to decide which one they want.
Part 3: Easy Connection via nmcli
Although we have talked about the ways to connect to it without a network manager, there is also the case of using nmcli (CLI version of the network manager) when it applies. To do this, we do the following:
Check to see which ESSID we can see:
nmcli dev wifi
Verify the name of the ESSID and we proceed on using it on the next line including the password needed for it (This includes WEP and WPA type passwords):
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD
Here is an example of me connecting to the ESSID Linux5G
If you have multiple wireless devices on your computer, you can specify which one to use using the
ifname
parameter like so:
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD ifname WIRELESS_DEVICE_NAME
For example in my case the name of the device is
wlp9s0
so I would use this line to specify the device that I will use to connect with:
More information about nmcli can be obtained by using the help parameter. For example if you wanted to know about about nmcli dev
you would type nmcli dev help
. If you wanted to know more about nmcli dev wifi
, you would type nmcli dev wifi help
and so on.
Part 4: Disconnecting from a Wireless Router
There are several ways of accomplishing this:
Disconnect by "force":
sudo ifconfig wlan0 down
This will turn your wireless card interface off (Driver turns off). To turn in on simply type
ifconfig wlan0 up
followed by asudo dhclient wlan0
. It will still show as connected if viewed by Network Manager but there will actually be no connection to the router. Trying toping
will throw anconnect: Network is unreachable
error.
Release the DHCP IP:
sudo dhclient -r wlan0
Remember to do
sudo dhclient wlan0
to assign yourself an IP again.
Disconnect using Network Manager:
nmcli nm enable false
Where nm is the parameter of nmcli that manages and sets Network Manager's states. The option
enable
can be true or false, meaning if set to false, all network connections managed by Network Manager will be disconnected. note that nmcli does not need root permissions.
To see the status of Network Manager type nmcli nm
, it should show something similar to this:
$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
Another way of turning the Connection On or Off (Connecting/Disconnecting) is by doing the following:
nmcli c down id NAME` - Will disconnect the connection NAME
nmcli c up id NAME` - Will connect the connection NAME
Part 5: Deleting a Connection
To delete an existing connection is fairly easy. First type in the terminal:
nmcli c
It will output something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Now let us say we want to delete Xcentral, we then proceed with the following command:
nmcli c delete id Xcentral
After doing it should look something like this:
$ nmcli c delete id Xcentral
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
All connections are stored in /etc/NetworkManager/system-connections/
If I were to look in that folder right now I would see the following files:
$ ls /etc/NetworkManager/system-connections
Intel pepe PrivateSys Realtek Virus
This is only in case you wish to edit/delete/add a connection by hand.
Part 6: Automatic connection when login in
For cases where you would like to login automatically to a wireless router here are the steps:
Open the
interface
file:
sudo nano /etc/network/interfaces
Add the following information (Assuming your interface is called wlan0):
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
Save the file and reboot computer. Note that this will be saved on a plain text file which can be accessed from the same computer.
Bonus: Find your wireless connection's name GUI Style
Click on the Network Manager and go to Connection Information
Go to the Tab that holds your wireless card
In this image, this network card is named eth1 (Inside the parenthesis) but this can be different for each user. Normally it would be a wlan (Like wlan0, wlan1, wlan2...) but it can also be eth1, eth2, etc.. So you need to see what name it has.
Another way to find the name quickly is by typing iwconfig
which will show all the wireless network card available.
3
If have found another command line way to find the name of the wireless interface. after typingiwlist
press tab twice and the terminal will automatically type the name of the interface afteriwilst
– Suhaib
Mar 30 '13 at 18:33
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
|
show 6 more comments
It's pretty easy if you know how to do it.
Show available wlan access points:
nmcli dev wifi
Connect with access point:
nmcli dev wifi connect $ACCESS_POINT password $PASSWORD
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
@Thorben IMHO this is not the accepted answer, becausenetwork manager command line interface
doesn't answer the original questionHow to connect without a network manager
.
– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
|
show 1 more comment
wicd comes with 2 command line utilities: wicd-curses and wicd-cli (they may require a separate install)
wicd-curse lets you configure/connect disconnect to networks (wired or wireless) interactively, wicd-cli offers the same functionality but through command line options only (useful for scripts) I use it in a cron job to work around some autoreconnect bugs:
wicd-cli -y -c -m MY_NETWORK_SSID
Also you can "just" have a wpa_supplicant configuration something like:
/etc/network/interface :
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
and (as a WPA example)
/etc/wpa.conf:
network={
ssid="MY_NETWORK_SSID"
proto=RSN
key_mgmt=WPA_PSK
pairwise=CCMP_TKIP
group=CCMP_TKIP
psk="my network key in the clear"
}
there are a lot of considerations to this, of which the security concern of having the preshared key in clear text (wpa_supplicant can let you present an encrypted or maybe just obfuscated key, check the man page), also making that file owned and readable only by root is a mitigation.
I think having several network sections would enable to connect several networks, by order of priority.
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
add a comment |
I use wicd-curses
, which I find to be the easiest user interface by far.
You need to use the → (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.
Of course you need to find some way of getting on the internet without wicd
; I'm assuming you have already solved that or else you wouldn't be posting.
(This is not timely to the OP, just posting for posterity since this question still comes up on Google. To the google-seekers: if you're reading this from a café or friend's computer or something, maybe you can use a wire somewhere to get wicd-curses
installed with sudo apt-get install wicd-curses
; then make sure you test it out on a network that's known to work before leaving!)
add a comment |
protected by Pilot6 Nov 14 '15 at 9:17
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
This applies to 12.04+ since these are the ones I could test but could also be used in older versions. I have separated this guide into several parts, which consist of:
Part 1 Wireless Routers with no password or WEP Key
Part 2 Wireless Routers with WPA or WPA2 security Key
Part 2.1 Connecting to a WPA Router with wpa_supplicant
Part 2.2 Connecting to a WPA Router with Network Manager
Part 3 Easy Connection Via nmcli
Part 4 Disconnecting from a Wireless Router
Part 5 Deleting a Connection (Including Configuration File)
Part 6 Automatic connection when login in
Bonus How to find your network interface name via GUI
The following command lines can be used to connect and disconnect depending on the Wireless card, wireless security and wireless router settings. Before proceeding, make sure the network service is enabled (For cases where you might start Ubuntu using Recovery mode):
Depending on your Ubuntu Version, you would need to start it using one of the following way:
If using SystemD (since 14.10+):
sudo systemctl start networking
If using the Legacy init.d way: sudo /etc/init.d/networking restart
If using the Legacy Upstart way: sudo service network-manager restart
Part 1: Wireless Routers with no password or WEP Key
For cases where the wireless router has no password or WEP security, do the following:
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option.To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
If it does not have a password do the following:
iwconfig wlan0 essid NAME_OF_ACCESS_POINT
For example
iwconfig wlan0 essid CYREX
after that, make sure to use
dhclient
so you can get a dynamic IP in case you don't get assigned one by the router. That should leave you connected to the CYREX router.
If it has a password then do:
iwconfig wlan0 essid CYREX key PASSWORD
That should connect using the PASSWORD you gave there.
Again, do
dhclient
after connecting to make sure you get an IP assigned.
Making sure you are correctly connected is always good so execute
iwconfig
to make sure your wireless card is connected to the SSID you mentioned above. It should show your device connected and the IP assigned to you. If it does not and gives you an error like Interface doesn't support scanning try the following 2 options:
- Test if your interface is UP:
sudo ifconfig wlan0 up
- Try adding
sudo
when doing the scan:sudo iwlist wlan0 s
Try bringing the device down and then back up:
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
- Test if your interface is UP:
Part 2: Wireless Routers with WPA or WPA2 security Key
For cases where the wireless router has a WPA/WPA2 password there are a few ways of doing this. I will mention the 2 most popular ones::
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option. To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
Part 2.1 WPA-SUPPLICANT GUIDE: Connecting to a WPA Router with wpa_supplicant
Type the following in the terminal (Assuming you have the
wpasupplicant
package installed which installs all the needed commands we will use here):
wpa_passphrase SSID PASSWORD > CONFIG_FILE
Example:
wpa_passphrase Virus LinuxFTW > wpa.conf
Where Virus is the name of my router,LinuxFTW is my password and
wpa.conf
is the file where I want to store all of this information in. Note that you can save the file in another place, many users save the file in/etc/wpa_supplicant.conf
instead ofwpa.conf
. The data of the wpa.conf file should be something like this:
network={
ssid="Virus"
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Up to this point, we should know the name of our wireless card interface (eg: Wlan0, eth2, Wlan2...). We now need to know which Driver is in use. for this we type:
wpa_supplicant
It should show us a lot of information, but there will be a section called **Drivers* which shows all available drivers (These are available when compiling
wpa_supplicant
). In my case it is like this:
drivers:
wext = Linux wireless extensions (generic)
nl80211 = Linux nl80211/cfg80211
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
The whole list is hostap, hermes, madwifi, wext, broadcom, wired, roboswitch, bsd, ndis. This can change depending on how
wpa_supplicant
was compiled, but the one that shows for me should be similar to the one on your system. Most users will select thewext
driver.
So now that we have our wireless interface card name and the driver name, we proceed to connect to it using the already created configuration file using the following format:
wpa_supplicant -iINTERFACE_NAME -cCONFIGURATION_FILE -DDRIVER_NAME
For example:
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Where
-i
is your interface card's name,-c
is where your configuration file is and-D
is the name of the driver you will be using to connect. If it connects correctly, then we press CTRL+C to cancel it and then execute the line again but this time we send it to the background with-B
so we can continue to use the terminal:
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
After that simply do a
sudo dhclient wlan0
to get an IP from the router.
Some users have reported removing the Hash and leaving only the password in the config, for example:
network={
ssid="Virus"
psk="LinuxFTW"
}
Others have added the ssid_scan to the config file:
network={
ssid="Virus"
scan_ssid=1
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Or even adding the Key type:
network={
ssid="Virus"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
More information about this in
man wpa_supplicant.conf
Part 2.2 NETWORK MANAGER GUIDE: Connecting to a WPA Router with Network Manager
The good thing about network manager is that it comes with a couple of nice scripts and tools. Two of these are nmcli
and create_connection
(Neat Python 3 script) which we will use in this case.
After doing the steps mentioned previously to find your router's SSID name (Remember the part about
iwlist
above) we do the following:
sudo /usr/share/checkbox/scripts/create_connection -S SECURITY_TYPE -K PASSWORD SSID_NAME
Where SECURITY is the type of security the Router uses (WPA, WEP), PASSWORD is.. well..the password and SSID_NAME is the SSID Name of the Router. For example:
sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
Will create a connection for Network Manager which should look something like this:
$ sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
[sudo] password for cyrex:
Connection Virus registered
Connection Virus activated.
After this, you should get an IP assigned from the router. If not simply do
sudo dhclient wlan0
(Assuming wlan0 is the name of your interface). You can also check your network manager's connections using nmcli like this:nmcli c
which should show something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Fri 05 Apr 2013 10:04:05 PM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 09 Apr 2013 06:31:10 AM VET
I mention the Network Manager's way because there are a couple of cases where using wpa_supplicant
will simply not work (Problems between router and wireless card, security issues, etc..). In my case, all attempts to use wpa_supplicant
on one PC did not work, but in another it worked the first time I tried. So am posting both methods to help on each case and to make it easier for users to decide which one they want.
Part 3: Easy Connection via nmcli
Although we have talked about the ways to connect to it without a network manager, there is also the case of using nmcli (CLI version of the network manager) when it applies. To do this, we do the following:
Check to see which ESSID we can see:
nmcli dev wifi
Verify the name of the ESSID and we proceed on using it on the next line including the password needed for it (This includes WEP and WPA type passwords):
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD
Here is an example of me connecting to the ESSID Linux5G
If you have multiple wireless devices on your computer, you can specify which one to use using the
ifname
parameter like so:
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD ifname WIRELESS_DEVICE_NAME
For example in my case the name of the device is
wlp9s0
so I would use this line to specify the device that I will use to connect with:
More information about nmcli can be obtained by using the help parameter. For example if you wanted to know about about nmcli dev
you would type nmcli dev help
. If you wanted to know more about nmcli dev wifi
, you would type nmcli dev wifi help
and so on.
Part 4: Disconnecting from a Wireless Router
There are several ways of accomplishing this:
Disconnect by "force":
sudo ifconfig wlan0 down
This will turn your wireless card interface off (Driver turns off). To turn in on simply type
ifconfig wlan0 up
followed by asudo dhclient wlan0
. It will still show as connected if viewed by Network Manager but there will actually be no connection to the router. Trying toping
will throw anconnect: Network is unreachable
error.
Release the DHCP IP:
sudo dhclient -r wlan0
Remember to do
sudo dhclient wlan0
to assign yourself an IP again.
Disconnect using Network Manager:
nmcli nm enable false
Where nm is the parameter of nmcli that manages and sets Network Manager's states. The option
enable
can be true or false, meaning if set to false, all network connections managed by Network Manager will be disconnected. note that nmcli does not need root permissions.
To see the status of Network Manager type nmcli nm
, it should show something similar to this:
$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
Another way of turning the Connection On or Off (Connecting/Disconnecting) is by doing the following:
nmcli c down id NAME` - Will disconnect the connection NAME
nmcli c up id NAME` - Will connect the connection NAME
Part 5: Deleting a Connection
To delete an existing connection is fairly easy. First type in the terminal:
nmcli c
It will output something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Now let us say we want to delete Xcentral, we then proceed with the following command:
nmcli c delete id Xcentral
After doing it should look something like this:
$ nmcli c delete id Xcentral
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
All connections are stored in /etc/NetworkManager/system-connections/
If I were to look in that folder right now I would see the following files:
$ ls /etc/NetworkManager/system-connections
Intel pepe PrivateSys Realtek Virus
This is only in case you wish to edit/delete/add a connection by hand.
Part 6: Automatic connection when login in
For cases where you would like to login automatically to a wireless router here are the steps:
Open the
interface
file:
sudo nano /etc/network/interfaces
Add the following information (Assuming your interface is called wlan0):
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
Save the file and reboot computer. Note that this will be saved on a plain text file which can be accessed from the same computer.
Bonus: Find your wireless connection's name GUI Style
Click on the Network Manager and go to Connection Information
Go to the Tab that holds your wireless card
In this image, this network card is named eth1 (Inside the parenthesis) but this can be different for each user. Normally it would be a wlan (Like wlan0, wlan1, wlan2...) but it can also be eth1, eth2, etc.. So you need to see what name it has.
Another way to find the name quickly is by typing iwconfig
which will show all the wireless network card available.
3
If have found another command line way to find the name of the wireless interface. after typingiwlist
press tab twice and the terminal will automatically type the name of the interface afteriwilst
– Suhaib
Mar 30 '13 at 18:33
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
|
show 6 more comments
This applies to 12.04+ since these are the ones I could test but could also be used in older versions. I have separated this guide into several parts, which consist of:
Part 1 Wireless Routers with no password or WEP Key
Part 2 Wireless Routers with WPA or WPA2 security Key
Part 2.1 Connecting to a WPA Router with wpa_supplicant
Part 2.2 Connecting to a WPA Router with Network Manager
Part 3 Easy Connection Via nmcli
Part 4 Disconnecting from a Wireless Router
Part 5 Deleting a Connection (Including Configuration File)
Part 6 Automatic connection when login in
Bonus How to find your network interface name via GUI
The following command lines can be used to connect and disconnect depending on the Wireless card, wireless security and wireless router settings. Before proceeding, make sure the network service is enabled (For cases where you might start Ubuntu using Recovery mode):
Depending on your Ubuntu Version, you would need to start it using one of the following way:
If using SystemD (since 14.10+):
sudo systemctl start networking
If using the Legacy init.d way: sudo /etc/init.d/networking restart
If using the Legacy Upstart way: sudo service network-manager restart
Part 1: Wireless Routers with no password or WEP Key
For cases where the wireless router has no password or WEP security, do the following:
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option.To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
If it does not have a password do the following:
iwconfig wlan0 essid NAME_OF_ACCESS_POINT
For example
iwconfig wlan0 essid CYREX
after that, make sure to use
dhclient
so you can get a dynamic IP in case you don't get assigned one by the router. That should leave you connected to the CYREX router.
If it has a password then do:
iwconfig wlan0 essid CYREX key PASSWORD
That should connect using the PASSWORD you gave there.
Again, do
dhclient
after connecting to make sure you get an IP assigned.
Making sure you are correctly connected is always good so execute
iwconfig
to make sure your wireless card is connected to the SSID you mentioned above. It should show your device connected and the IP assigned to you. If it does not and gives you an error like Interface doesn't support scanning try the following 2 options:
- Test if your interface is UP:
sudo ifconfig wlan0 up
- Try adding
sudo
when doing the scan:sudo iwlist wlan0 s
Try bringing the device down and then back up:
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
- Test if your interface is UP:
Part 2: Wireless Routers with WPA or WPA2 security Key
For cases where the wireless router has a WPA/WPA2 password there are a few ways of doing this. I will mention the 2 most popular ones::
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option. To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
Part 2.1 WPA-SUPPLICANT GUIDE: Connecting to a WPA Router with wpa_supplicant
Type the following in the terminal (Assuming you have the
wpasupplicant
package installed which installs all the needed commands we will use here):
wpa_passphrase SSID PASSWORD > CONFIG_FILE
Example:
wpa_passphrase Virus LinuxFTW > wpa.conf
Where Virus is the name of my router,LinuxFTW is my password and
wpa.conf
is the file where I want to store all of this information in. Note that you can save the file in another place, many users save the file in/etc/wpa_supplicant.conf
instead ofwpa.conf
. The data of the wpa.conf file should be something like this:
network={
ssid="Virus"
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Up to this point, we should know the name of our wireless card interface (eg: Wlan0, eth2, Wlan2...). We now need to know which Driver is in use. for this we type:
wpa_supplicant
It should show us a lot of information, but there will be a section called **Drivers* which shows all available drivers (These are available when compiling
wpa_supplicant
). In my case it is like this:
drivers:
wext = Linux wireless extensions (generic)
nl80211 = Linux nl80211/cfg80211
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
The whole list is hostap, hermes, madwifi, wext, broadcom, wired, roboswitch, bsd, ndis. This can change depending on how
wpa_supplicant
was compiled, but the one that shows for me should be similar to the one on your system. Most users will select thewext
driver.
So now that we have our wireless interface card name and the driver name, we proceed to connect to it using the already created configuration file using the following format:
wpa_supplicant -iINTERFACE_NAME -cCONFIGURATION_FILE -DDRIVER_NAME
For example:
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Where
-i
is your interface card's name,-c
is where your configuration file is and-D
is the name of the driver you will be using to connect. If it connects correctly, then we press CTRL+C to cancel it and then execute the line again but this time we send it to the background with-B
so we can continue to use the terminal:
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
After that simply do a
sudo dhclient wlan0
to get an IP from the router.
Some users have reported removing the Hash and leaving only the password in the config, for example:
network={
ssid="Virus"
psk="LinuxFTW"
}
Others have added the ssid_scan to the config file:
network={
ssid="Virus"
scan_ssid=1
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Or even adding the Key type:
network={
ssid="Virus"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
More information about this in
man wpa_supplicant.conf
Part 2.2 NETWORK MANAGER GUIDE: Connecting to a WPA Router with Network Manager
The good thing about network manager is that it comes with a couple of nice scripts and tools. Two of these are nmcli
and create_connection
(Neat Python 3 script) which we will use in this case.
After doing the steps mentioned previously to find your router's SSID name (Remember the part about
iwlist
above) we do the following:
sudo /usr/share/checkbox/scripts/create_connection -S SECURITY_TYPE -K PASSWORD SSID_NAME
Where SECURITY is the type of security the Router uses (WPA, WEP), PASSWORD is.. well..the password and SSID_NAME is the SSID Name of the Router. For example:
sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
Will create a connection for Network Manager which should look something like this:
$ sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
[sudo] password for cyrex:
Connection Virus registered
Connection Virus activated.
After this, you should get an IP assigned from the router. If not simply do
sudo dhclient wlan0
(Assuming wlan0 is the name of your interface). You can also check your network manager's connections using nmcli like this:nmcli c
which should show something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Fri 05 Apr 2013 10:04:05 PM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 09 Apr 2013 06:31:10 AM VET
I mention the Network Manager's way because there are a couple of cases where using wpa_supplicant
will simply not work (Problems between router and wireless card, security issues, etc..). In my case, all attempts to use wpa_supplicant
on one PC did not work, but in another it worked the first time I tried. So am posting both methods to help on each case and to make it easier for users to decide which one they want.
Part 3: Easy Connection via nmcli
Although we have talked about the ways to connect to it without a network manager, there is also the case of using nmcli (CLI version of the network manager) when it applies. To do this, we do the following:
Check to see which ESSID we can see:
nmcli dev wifi
Verify the name of the ESSID and we proceed on using it on the next line including the password needed for it (This includes WEP and WPA type passwords):
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD
Here is an example of me connecting to the ESSID Linux5G
If you have multiple wireless devices on your computer, you can specify which one to use using the
ifname
parameter like so:
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD ifname WIRELESS_DEVICE_NAME
For example in my case the name of the device is
wlp9s0
so I would use this line to specify the device that I will use to connect with:
More information about nmcli can be obtained by using the help parameter. For example if you wanted to know about about nmcli dev
you would type nmcli dev help
. If you wanted to know more about nmcli dev wifi
, you would type nmcli dev wifi help
and so on.
Part 4: Disconnecting from a Wireless Router
There are several ways of accomplishing this:
Disconnect by "force":
sudo ifconfig wlan0 down
This will turn your wireless card interface off (Driver turns off). To turn in on simply type
ifconfig wlan0 up
followed by asudo dhclient wlan0
. It will still show as connected if viewed by Network Manager but there will actually be no connection to the router. Trying toping
will throw anconnect: Network is unreachable
error.
Release the DHCP IP:
sudo dhclient -r wlan0
Remember to do
sudo dhclient wlan0
to assign yourself an IP again.
Disconnect using Network Manager:
nmcli nm enable false
Where nm is the parameter of nmcli that manages and sets Network Manager's states. The option
enable
can be true or false, meaning if set to false, all network connections managed by Network Manager will be disconnected. note that nmcli does not need root permissions.
To see the status of Network Manager type nmcli nm
, it should show something similar to this:
$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
Another way of turning the Connection On or Off (Connecting/Disconnecting) is by doing the following:
nmcli c down id NAME` - Will disconnect the connection NAME
nmcli c up id NAME` - Will connect the connection NAME
Part 5: Deleting a Connection
To delete an existing connection is fairly easy. First type in the terminal:
nmcli c
It will output something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Now let us say we want to delete Xcentral, we then proceed with the following command:
nmcli c delete id Xcentral
After doing it should look something like this:
$ nmcli c delete id Xcentral
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
All connections are stored in /etc/NetworkManager/system-connections/
If I were to look in that folder right now I would see the following files:
$ ls /etc/NetworkManager/system-connections
Intel pepe PrivateSys Realtek Virus
This is only in case you wish to edit/delete/add a connection by hand.
Part 6: Automatic connection when login in
For cases where you would like to login automatically to a wireless router here are the steps:
Open the
interface
file:
sudo nano /etc/network/interfaces
Add the following information (Assuming your interface is called wlan0):
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
Save the file and reboot computer. Note that this will be saved on a plain text file which can be accessed from the same computer.
Bonus: Find your wireless connection's name GUI Style
Click on the Network Manager and go to Connection Information
Go to the Tab that holds your wireless card
In this image, this network card is named eth1 (Inside the parenthesis) but this can be different for each user. Normally it would be a wlan (Like wlan0, wlan1, wlan2...) but it can also be eth1, eth2, etc.. So you need to see what name it has.
Another way to find the name quickly is by typing iwconfig
which will show all the wireless network card available.
3
If have found another command line way to find the name of the wireless interface. after typingiwlist
press tab twice and the terminal will automatically type the name of the interface afteriwilst
– Suhaib
Mar 30 '13 at 18:33
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
|
show 6 more comments
This applies to 12.04+ since these are the ones I could test but could also be used in older versions. I have separated this guide into several parts, which consist of:
Part 1 Wireless Routers with no password or WEP Key
Part 2 Wireless Routers with WPA or WPA2 security Key
Part 2.1 Connecting to a WPA Router with wpa_supplicant
Part 2.2 Connecting to a WPA Router with Network Manager
Part 3 Easy Connection Via nmcli
Part 4 Disconnecting from a Wireless Router
Part 5 Deleting a Connection (Including Configuration File)
Part 6 Automatic connection when login in
Bonus How to find your network interface name via GUI
The following command lines can be used to connect and disconnect depending on the Wireless card, wireless security and wireless router settings. Before proceeding, make sure the network service is enabled (For cases where you might start Ubuntu using Recovery mode):
Depending on your Ubuntu Version, you would need to start it using one of the following way:
If using SystemD (since 14.10+):
sudo systemctl start networking
If using the Legacy init.d way: sudo /etc/init.d/networking restart
If using the Legacy Upstart way: sudo service network-manager restart
Part 1: Wireless Routers with no password or WEP Key
For cases where the wireless router has no password or WEP security, do the following:
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option.To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
If it does not have a password do the following:
iwconfig wlan0 essid NAME_OF_ACCESS_POINT
For example
iwconfig wlan0 essid CYREX
after that, make sure to use
dhclient
so you can get a dynamic IP in case you don't get assigned one by the router. That should leave you connected to the CYREX router.
If it has a password then do:
iwconfig wlan0 essid CYREX key PASSWORD
That should connect using the PASSWORD you gave there.
Again, do
dhclient
after connecting to make sure you get an IP assigned.
Making sure you are correctly connected is always good so execute
iwconfig
to make sure your wireless card is connected to the SSID you mentioned above. It should show your device connected and the IP assigned to you. If it does not and gives you an error like Interface doesn't support scanning try the following 2 options:
- Test if your interface is UP:
sudo ifconfig wlan0 up
- Try adding
sudo
when doing the scan:sudo iwlist wlan0 s
Try bringing the device down and then back up:
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
- Test if your interface is UP:
Part 2: Wireless Routers with WPA or WPA2 security Key
For cases where the wireless router has a WPA/WPA2 password there are a few ways of doing this. I will mention the 2 most popular ones::
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option. To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
Part 2.1 WPA-SUPPLICANT GUIDE: Connecting to a WPA Router with wpa_supplicant
Type the following in the terminal (Assuming you have the
wpasupplicant
package installed which installs all the needed commands we will use here):
wpa_passphrase SSID PASSWORD > CONFIG_FILE
Example:
wpa_passphrase Virus LinuxFTW > wpa.conf
Where Virus is the name of my router,LinuxFTW is my password and
wpa.conf
is the file where I want to store all of this information in. Note that you can save the file in another place, many users save the file in/etc/wpa_supplicant.conf
instead ofwpa.conf
. The data of the wpa.conf file should be something like this:
network={
ssid="Virus"
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Up to this point, we should know the name of our wireless card interface (eg: Wlan0, eth2, Wlan2...). We now need to know which Driver is in use. for this we type:
wpa_supplicant
It should show us a lot of information, but there will be a section called **Drivers* which shows all available drivers (These are available when compiling
wpa_supplicant
). In my case it is like this:
drivers:
wext = Linux wireless extensions (generic)
nl80211 = Linux nl80211/cfg80211
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
The whole list is hostap, hermes, madwifi, wext, broadcom, wired, roboswitch, bsd, ndis. This can change depending on how
wpa_supplicant
was compiled, but the one that shows for me should be similar to the one on your system. Most users will select thewext
driver.
So now that we have our wireless interface card name and the driver name, we proceed to connect to it using the already created configuration file using the following format:
wpa_supplicant -iINTERFACE_NAME -cCONFIGURATION_FILE -DDRIVER_NAME
For example:
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Where
-i
is your interface card's name,-c
is where your configuration file is and-D
is the name of the driver you will be using to connect. If it connects correctly, then we press CTRL+C to cancel it and then execute the line again but this time we send it to the background with-B
so we can continue to use the terminal:
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
After that simply do a
sudo dhclient wlan0
to get an IP from the router.
Some users have reported removing the Hash and leaving only the password in the config, for example:
network={
ssid="Virus"
psk="LinuxFTW"
}
Others have added the ssid_scan to the config file:
network={
ssid="Virus"
scan_ssid=1
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Or even adding the Key type:
network={
ssid="Virus"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
More information about this in
man wpa_supplicant.conf
Part 2.2 NETWORK MANAGER GUIDE: Connecting to a WPA Router with Network Manager
The good thing about network manager is that it comes with a couple of nice scripts and tools. Two of these are nmcli
and create_connection
(Neat Python 3 script) which we will use in this case.
After doing the steps mentioned previously to find your router's SSID name (Remember the part about
iwlist
above) we do the following:
sudo /usr/share/checkbox/scripts/create_connection -S SECURITY_TYPE -K PASSWORD SSID_NAME
Where SECURITY is the type of security the Router uses (WPA, WEP), PASSWORD is.. well..the password and SSID_NAME is the SSID Name of the Router. For example:
sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
Will create a connection for Network Manager which should look something like this:
$ sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
[sudo] password for cyrex:
Connection Virus registered
Connection Virus activated.
After this, you should get an IP assigned from the router. If not simply do
sudo dhclient wlan0
(Assuming wlan0 is the name of your interface). You can also check your network manager's connections using nmcli like this:nmcli c
which should show something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Fri 05 Apr 2013 10:04:05 PM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 09 Apr 2013 06:31:10 AM VET
I mention the Network Manager's way because there are a couple of cases where using wpa_supplicant
will simply not work (Problems between router and wireless card, security issues, etc..). In my case, all attempts to use wpa_supplicant
on one PC did not work, but in another it worked the first time I tried. So am posting both methods to help on each case and to make it easier for users to decide which one they want.
Part 3: Easy Connection via nmcli
Although we have talked about the ways to connect to it without a network manager, there is also the case of using nmcli (CLI version of the network manager) when it applies. To do this, we do the following:
Check to see which ESSID we can see:
nmcli dev wifi
Verify the name of the ESSID and we proceed on using it on the next line including the password needed for it (This includes WEP and WPA type passwords):
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD
Here is an example of me connecting to the ESSID Linux5G
If you have multiple wireless devices on your computer, you can specify which one to use using the
ifname
parameter like so:
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD ifname WIRELESS_DEVICE_NAME
For example in my case the name of the device is
wlp9s0
so I would use this line to specify the device that I will use to connect with:
More information about nmcli can be obtained by using the help parameter. For example if you wanted to know about about nmcli dev
you would type nmcli dev help
. If you wanted to know more about nmcli dev wifi
, you would type nmcli dev wifi help
and so on.
Part 4: Disconnecting from a Wireless Router
There are several ways of accomplishing this:
Disconnect by "force":
sudo ifconfig wlan0 down
This will turn your wireless card interface off (Driver turns off). To turn in on simply type
ifconfig wlan0 up
followed by asudo dhclient wlan0
. It will still show as connected if viewed by Network Manager but there will actually be no connection to the router. Trying toping
will throw anconnect: Network is unreachable
error.
Release the DHCP IP:
sudo dhclient -r wlan0
Remember to do
sudo dhclient wlan0
to assign yourself an IP again.
Disconnect using Network Manager:
nmcli nm enable false
Where nm is the parameter of nmcli that manages and sets Network Manager's states. The option
enable
can be true or false, meaning if set to false, all network connections managed by Network Manager will be disconnected. note that nmcli does not need root permissions.
To see the status of Network Manager type nmcli nm
, it should show something similar to this:
$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
Another way of turning the Connection On or Off (Connecting/Disconnecting) is by doing the following:
nmcli c down id NAME` - Will disconnect the connection NAME
nmcli c up id NAME` - Will connect the connection NAME
Part 5: Deleting a Connection
To delete an existing connection is fairly easy. First type in the terminal:
nmcli c
It will output something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Now let us say we want to delete Xcentral, we then proceed with the following command:
nmcli c delete id Xcentral
After doing it should look something like this:
$ nmcli c delete id Xcentral
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
All connections are stored in /etc/NetworkManager/system-connections/
If I were to look in that folder right now I would see the following files:
$ ls /etc/NetworkManager/system-connections
Intel pepe PrivateSys Realtek Virus
This is only in case you wish to edit/delete/add a connection by hand.
Part 6: Automatic connection when login in
For cases where you would like to login automatically to a wireless router here are the steps:
Open the
interface
file:
sudo nano /etc/network/interfaces
Add the following information (Assuming your interface is called wlan0):
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
Save the file and reboot computer. Note that this will be saved on a plain text file which can be accessed from the same computer.
Bonus: Find your wireless connection's name GUI Style
Click on the Network Manager and go to Connection Information
Go to the Tab that holds your wireless card
In this image, this network card is named eth1 (Inside the parenthesis) but this can be different for each user. Normally it would be a wlan (Like wlan0, wlan1, wlan2...) but it can also be eth1, eth2, etc.. So you need to see what name it has.
Another way to find the name quickly is by typing iwconfig
which will show all the wireless network card available.
This applies to 12.04+ since these are the ones I could test but could also be used in older versions. I have separated this guide into several parts, which consist of:
Part 1 Wireless Routers with no password or WEP Key
Part 2 Wireless Routers with WPA or WPA2 security Key
Part 2.1 Connecting to a WPA Router with wpa_supplicant
Part 2.2 Connecting to a WPA Router with Network Manager
Part 3 Easy Connection Via nmcli
Part 4 Disconnecting from a Wireless Router
Part 5 Deleting a Connection (Including Configuration File)
Part 6 Automatic connection when login in
Bonus How to find your network interface name via GUI
The following command lines can be used to connect and disconnect depending on the Wireless card, wireless security and wireless router settings. Before proceeding, make sure the network service is enabled (For cases where you might start Ubuntu using Recovery mode):
Depending on your Ubuntu Version, you would need to start it using one of the following way:
If using SystemD (since 14.10+):
sudo systemctl start networking
If using the Legacy init.d way: sudo /etc/init.d/networking restart
If using the Legacy Upstart way: sudo service network-manager restart
Part 1: Wireless Routers with no password or WEP Key
For cases where the wireless router has no password or WEP security, do the following:
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option.To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
If it does not have a password do the following:
iwconfig wlan0 essid NAME_OF_ACCESS_POINT
For example
iwconfig wlan0 essid CYREX
after that, make sure to use
dhclient
so you can get a dynamic IP in case you don't get assigned one by the router. That should leave you connected to the CYREX router.
If it has a password then do:
iwconfig wlan0 essid CYREX key PASSWORD
That should connect using the PASSWORD you gave there.
Again, do
dhclient
after connecting to make sure you get an IP assigned.
Making sure you are correctly connected is always good so execute
iwconfig
to make sure your wireless card is connected to the SSID you mentioned above. It should show your device connected and the IP assigned to you. If it does not and gives you an error like Interface doesn't support scanning try the following 2 options:
- Test if your interface is UP:
sudo ifconfig wlan0 up
- Try adding
sudo
when doing the scan:sudo iwlist wlan0 s
Try bringing the device down and then back up:
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
- Test if your interface is UP:
Part 2: Wireless Routers with WPA or WPA2 security Key
For cases where the wireless router has a WPA/WPA2 password there are a few ways of doing this. I will mention the 2 most popular ones::
Open the terminal and lookup for the wireless connection:
iwlist wlan0 s
(The s is for Scan. wlan0 is my wireless card but could be different for each user. Some have eth0, others wlan2.. You need
sudo
to execute this option. To find out the name of your wireless card simply type iwlist and press TAB. This should autocomplete the line with the network card's name. You can also typeiwconfig
and find the name on the list that will show.)
If you do not know the name of your wireless devices type:
iwconfig
which will show you your wired/wireless devices and their names. They might be something like wlan0, wlan1, eth1, eth2..
The lookup will show you all possible Access Points (AP) visible to you. After you see your router in the list try to connect to it:
Part 2.1 WPA-SUPPLICANT GUIDE: Connecting to a WPA Router with wpa_supplicant
Type the following in the terminal (Assuming you have the
wpasupplicant
package installed which installs all the needed commands we will use here):
wpa_passphrase SSID PASSWORD > CONFIG_FILE
Example:
wpa_passphrase Virus LinuxFTW > wpa.conf
Where Virus is the name of my router,LinuxFTW is my password and
wpa.conf
is the file where I want to store all of this information in. Note that you can save the file in another place, many users save the file in/etc/wpa_supplicant.conf
instead ofwpa.conf
. The data of the wpa.conf file should be something like this:
network={
ssid="Virus"
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Up to this point, we should know the name of our wireless card interface (eg: Wlan0, eth2, Wlan2...). We now need to know which Driver is in use. for this we type:
wpa_supplicant
It should show us a lot of information, but there will be a section called **Drivers* which shows all available drivers (These are available when compiling
wpa_supplicant
). In my case it is like this:
drivers:
wext = Linux wireless extensions (generic)
nl80211 = Linux nl80211/cfg80211
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
The whole list is hostap, hermes, madwifi, wext, broadcom, wired, roboswitch, bsd, ndis. This can change depending on how
wpa_supplicant
was compiled, but the one that shows for me should be similar to the one on your system. Most users will select thewext
driver.
So now that we have our wireless interface card name and the driver name, we proceed to connect to it using the already created configuration file using the following format:
wpa_supplicant -iINTERFACE_NAME -cCONFIGURATION_FILE -DDRIVER_NAME
For example:
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Where
-i
is your interface card's name,-c
is where your configuration file is and-D
is the name of the driver you will be using to connect. If it connects correctly, then we press CTRL+C to cancel it and then execute the line again but this time we send it to the background with-B
so we can continue to use the terminal:
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
After that simply do a
sudo dhclient wlan0
to get an IP from the router.
Some users have reported removing the Hash and leaving only the password in the config, for example:
network={
ssid="Virus"
psk="LinuxFTW"
}
Others have added the ssid_scan to the config file:
network={
ssid="Virus"
scan_ssid=1
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
Or even adding the Key type:
network={
ssid="Virus"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="LinuxFTW"
psk=1d538d505f48205589ad25b2ca9f52f9cbb67687e310c58a8dd940ccc03fbfae
}
More information about this in
man wpa_supplicant.conf
Part 2.2 NETWORK MANAGER GUIDE: Connecting to a WPA Router with Network Manager
The good thing about network manager is that it comes with a couple of nice scripts and tools. Two of these are nmcli
and create_connection
(Neat Python 3 script) which we will use in this case.
After doing the steps mentioned previously to find your router's SSID name (Remember the part about
iwlist
above) we do the following:
sudo /usr/share/checkbox/scripts/create_connection -S SECURITY_TYPE -K PASSWORD SSID_NAME
Where SECURITY is the type of security the Router uses (WPA, WEP), PASSWORD is.. well..the password and SSID_NAME is the SSID Name of the Router. For example:
sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
Will create a connection for Network Manager which should look something like this:
$ sudo /usr/share/checkbox/scripts/create_connection -S wpa -K LinuxFTW Virus
[sudo] password for cyrex:
Connection Virus registered
Connection Virus activated.
After this, you should get an IP assigned from the router. If not simply do
sudo dhclient wlan0
(Assuming wlan0 is the name of your interface). You can also check your network manager's connections using nmcli like this:nmcli c
which should show something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Fri 05 Apr 2013 10:04:05 PM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 09 Apr 2013 06:31:10 AM VET
I mention the Network Manager's way because there are a couple of cases where using wpa_supplicant
will simply not work (Problems between router and wireless card, security issues, etc..). In my case, all attempts to use wpa_supplicant
on one PC did not work, but in another it worked the first time I tried. So am posting both methods to help on each case and to make it easier for users to decide which one they want.
Part 3: Easy Connection via nmcli
Although we have talked about the ways to connect to it without a network manager, there is also the case of using nmcli (CLI version of the network manager) when it applies. To do this, we do the following:
Check to see which ESSID we can see:
nmcli dev wifi
Verify the name of the ESSID and we proceed on using it on the next line including the password needed for it (This includes WEP and WPA type passwords):
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD
Here is an example of me connecting to the ESSID Linux5G
If you have multiple wireless devices on your computer, you can specify which one to use using the
ifname
parameter like so:
nmcli dev wifi connect ESSID_NAME password ESSID_PASSWORD ifname WIRELESS_DEVICE_NAME
For example in my case the name of the device is
wlp9s0
so I would use this line to specify the device that I will use to connect with:
More information about nmcli can be obtained by using the help parameter. For example if you wanted to know about about nmcli dev
you would type nmcli dev help
. If you wanted to know more about nmcli dev wifi
, you would type nmcli dev wifi help
and so on.
Part 4: Disconnecting from a Wireless Router
There are several ways of accomplishing this:
Disconnect by "force":
sudo ifconfig wlan0 down
This will turn your wireless card interface off (Driver turns off). To turn in on simply type
ifconfig wlan0 up
followed by asudo dhclient wlan0
. It will still show as connected if viewed by Network Manager but there will actually be no connection to the router. Trying toping
will throw anconnect: Network is unreachable
error.
Release the DHCP IP:
sudo dhclient -r wlan0
Remember to do
sudo dhclient wlan0
to assign yourself an IP again.
Disconnect using Network Manager:
nmcli nm enable false
Where nm is the parameter of nmcli that manages and sets Network Manager's states. The option
enable
can be true or false, meaning if set to false, all network connections managed by Network Manager will be disconnected. note that nmcli does not need root permissions.
To see the status of Network Manager type nmcli nm
, it should show something similar to this:
$ nmcli nm
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected enabled enabled enabled enabled
Another way of turning the Connection On or Off (Connecting/Disconnecting) is by doing the following:
nmcli c down id NAME` - Will disconnect the connection NAME
nmcli c up id NAME` - Will connect the connection NAME
Part 5: Deleting a Connection
To delete an existing connection is fairly easy. First type in the terminal:
nmcli c
It will output something like this:
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
Xcentral f51a5a64-8a91-47d6-897c-28efcd84d2b0 802-11-wireless Fri 22 Mar 2013 02:25:54 PM VET
Now let us say we want to delete Xcentral, we then proceed with the following command:
nmcli c delete id Xcentral
After doing it should look something like this:
$ nmcli c delete id Xcentral
$ nmcli c
NAME UUID TYPE TIMESTAMP-REAL
Realtek 9ded7740-ad29-4c8f-861f-84ec4da87f8d 802-3-ethernet Tue 05 Mar 2013 01:18:31 AM VET
PrivateSys 86b2b37d-4835-44f1-ba95-46c4b747140f 802-11-wireless Sun 21 Apr 2013 07:52:57 PM VET
pepe 9887664b-183a-45c0-a81f-27d5d0e6d9d8 802-11-wireless Thu 18 Apr 2013 02:43:05 AM VET
Virus 3f8ced55-507b-4558-a70b-0d260441f570 802-11-wireless Tue 16 Apr 2013 11:33:24 AM VET
Intel e25b1fd8-c4ff-41ac-a6bc-22620296f01c 802-3-ethernet Sun 21 Apr 2013 08:12:29 PM VET
All connections are stored in /etc/NetworkManager/system-connections/
If I were to look in that folder right now I would see the following files:
$ ls /etc/NetworkManager/system-connections
Intel pepe PrivateSys Realtek Virus
This is only in case you wish to edit/delete/add a connection by hand.
Part 6: Automatic connection when login in
For cases where you would like to login automatically to a wireless router here are the steps:
Open the
interface
file:
sudo nano /etc/network/interfaces
Add the following information (Assuming your interface is called wlan0):
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
Save the file and reboot computer. Note that this will be saved on a plain text file which can be accessed from the same computer.
Bonus: Find your wireless connection's name GUI Style
Click on the Network Manager and go to Connection Information
Go to the Tab that holds your wireless card
In this image, this network card is named eth1 (Inside the parenthesis) but this can be different for each user. Normally it would be a wlan (Like wlan0, wlan1, wlan2...) but it can also be eth1, eth2, etc.. So you need to see what name it has.
Another way to find the name quickly is by typing iwconfig
which will show all the wireless network card available.
edited 13 mins ago
Pablo Bianchi
2,75821533
2,75821533
answered Dec 7 '10 at 21:26
Luis Alvarado♦Luis Alvarado
146k138486654
146k138486654
3
If have found another command line way to find the name of the wireless interface. after typingiwlist
press tab twice and the terminal will automatically type the name of the interface afteriwilst
– Suhaib
Mar 30 '13 at 18:33
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
|
show 6 more comments
3
If have found another command line way to find the name of the wireless interface. after typingiwlist
press tab twice and the terminal will automatically type the name of the interface afteriwilst
– Suhaib
Mar 30 '13 at 18:33
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
3
3
If have found another command line way to find the name of the wireless interface. after typing
iwlist
press tab twice and the terminal will automatically type the name of the interface after iwilst
– Suhaib
Mar 30 '13 at 18:33
If have found another command line way to find the name of the wireless interface. after typing
iwlist
press tab twice and the terminal will automatically type the name of the interface after iwilst
– Suhaib
Mar 30 '13 at 18:33
2
2
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
I could correctly guess the author looking at the completeness of the answer.
– jobin
Jun 22 '14 at 17:52
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
what if theres a space in the ssid? like my ssid is sugar fairy
– askcompu
Sep 18 '14 at 17:50
1
1
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
@douglaswalrath You would use quotes, as in "sugar fairy"
– Luis Alvarado♦
Sep 18 '14 at 17:55
1
1
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
@Michele this other answer gives guidance on how to prevent the password from being saved on the history askubuntu.com/a/279333/237654
– Hector Correa
Jan 11 '15 at 21:56
|
show 6 more comments
It's pretty easy if you know how to do it.
Show available wlan access points:
nmcli dev wifi
Connect with access point:
nmcli dev wifi connect $ACCESS_POINT password $PASSWORD
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
@Thorben IMHO this is not the accepted answer, becausenetwork manager command line interface
doesn't answer the original questionHow to connect without a network manager
.
– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
|
show 1 more comment
It's pretty easy if you know how to do it.
Show available wlan access points:
nmcli dev wifi
Connect with access point:
nmcli dev wifi connect $ACCESS_POINT password $PASSWORD
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
@Thorben IMHO this is not the accepted answer, becausenetwork manager command line interface
doesn't answer the original questionHow to connect without a network manager
.
– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
|
show 1 more comment
It's pretty easy if you know how to do it.
Show available wlan access points:
nmcli dev wifi
Connect with access point:
nmcli dev wifi connect $ACCESS_POINT password $PASSWORD
It's pretty easy if you know how to do it.
Show available wlan access points:
nmcli dev wifi
Connect with access point:
nmcli dev wifi connect $ACCESS_POINT password $PASSWORD
edited Sep 13 '14 at 12:50
answered Sep 13 '14 at 12:44
Ikem KruegerIkem Krueger
49145
49145
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
@Thorben IMHO this is not the accepted answer, becausenetwork manager command line interface
doesn't answer the original questionHow to connect without a network manager
.
– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
|
show 1 more comment
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
@Thorben IMHO this is not the accepted answer, becausenetwork manager command line interface
doesn't answer the original questionHow to connect without a network manager
.
– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
2
2
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
This is far better than the up-voted answer from Alvarado, which did not work in my case (Linux Mint 17.1). But this is pretty simple and just WORKS!
– Thorben
Feb 7 '15 at 21:13
1
1
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
worked for me on Linux Mint 17
– David Okwii
May 9 '15 at 16:26
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
This is the winning answer for me. Just quick, easy and secure. Thank you!.
– GTRONICK
Jan 8 '17 at 15:29
3
3
@Thorben IMHO this is not the accepted answer, because
network manager command line interface
doesn't answer the original question How to connect without a network manager
.– Vorac
May 5 '17 at 5:00
@Thorben IMHO this is not the accepted answer, because
network manager command line interface
doesn't answer the original question How to connect without a network manager
.– Vorac
May 5 '17 at 5:00
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
+1 because this answer, although not applying to the question, would help someone when on recovery mode and save time. Excellent work user82110.
– Luis Alvarado♦
May 28 '17 at 16:19
|
show 1 more comment
wicd comes with 2 command line utilities: wicd-curses and wicd-cli (they may require a separate install)
wicd-curse lets you configure/connect disconnect to networks (wired or wireless) interactively, wicd-cli offers the same functionality but through command line options only (useful for scripts) I use it in a cron job to work around some autoreconnect bugs:
wicd-cli -y -c -m MY_NETWORK_SSID
Also you can "just" have a wpa_supplicant configuration something like:
/etc/network/interface :
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
and (as a WPA example)
/etc/wpa.conf:
network={
ssid="MY_NETWORK_SSID"
proto=RSN
key_mgmt=WPA_PSK
pairwise=CCMP_TKIP
group=CCMP_TKIP
psk="my network key in the clear"
}
there are a lot of considerations to this, of which the security concern of having the preshared key in clear text (wpa_supplicant can let you present an encrypted or maybe just obfuscated key, check the man page), also making that file owned and readable only by root is a mitigation.
I think having several network sections would enable to connect several networks, by order of priority.
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
add a comment |
wicd comes with 2 command line utilities: wicd-curses and wicd-cli (they may require a separate install)
wicd-curse lets you configure/connect disconnect to networks (wired or wireless) interactively, wicd-cli offers the same functionality but through command line options only (useful for scripts) I use it in a cron job to work around some autoreconnect bugs:
wicd-cli -y -c -m MY_NETWORK_SSID
Also you can "just" have a wpa_supplicant configuration something like:
/etc/network/interface :
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
and (as a WPA example)
/etc/wpa.conf:
network={
ssid="MY_NETWORK_SSID"
proto=RSN
key_mgmt=WPA_PSK
pairwise=CCMP_TKIP
group=CCMP_TKIP
psk="my network key in the clear"
}
there are a lot of considerations to this, of which the security concern of having the preshared key in clear text (wpa_supplicant can let you present an encrypted or maybe just obfuscated key, check the man page), also making that file owned and readable only by root is a mitigation.
I think having several network sections would enable to connect several networks, by order of priority.
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
add a comment |
wicd comes with 2 command line utilities: wicd-curses and wicd-cli (they may require a separate install)
wicd-curse lets you configure/connect disconnect to networks (wired or wireless) interactively, wicd-cli offers the same functionality but through command line options only (useful for scripts) I use it in a cron job to work around some autoreconnect bugs:
wicd-cli -y -c -m MY_NETWORK_SSID
Also you can "just" have a wpa_supplicant configuration something like:
/etc/network/interface :
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
and (as a WPA example)
/etc/wpa.conf:
network={
ssid="MY_NETWORK_SSID"
proto=RSN
key_mgmt=WPA_PSK
pairwise=CCMP_TKIP
group=CCMP_TKIP
psk="my network key in the clear"
}
there are a lot of considerations to this, of which the security concern of having the preshared key in clear text (wpa_supplicant can let you present an encrypted or maybe just obfuscated key, check the man page), also making that file owned and readable only by root is a mitigation.
I think having several network sections would enable to connect several networks, by order of priority.
wicd comes with 2 command line utilities: wicd-curses and wicd-cli (they may require a separate install)
wicd-curse lets you configure/connect disconnect to networks (wired or wireless) interactively, wicd-cli offers the same functionality but through command line options only (useful for scripts) I use it in a cron job to work around some autoreconnect bugs:
wicd-cli -y -c -m MY_NETWORK_SSID
Also you can "just" have a wpa_supplicant configuration something like:
/etc/network/interface :
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
and (as a WPA example)
/etc/wpa.conf:
network={
ssid="MY_NETWORK_SSID"
proto=RSN
key_mgmt=WPA_PSK
pairwise=CCMP_TKIP
group=CCMP_TKIP
psk="my network key in the clear"
}
there are a lot of considerations to this, of which the security concern of having the preshared key in clear text (wpa_supplicant can let you present an encrypted or maybe just obfuscated key, check the man page), also making that file owned and readable only by root is a mitigation.
I think having several network sections would enable to connect several networks, by order of priority.
answered Dec 31 '12 at 4:33
PhilippePhilippe
12112
12112
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
add a comment |
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
wicd is not installed by default, not sure if it compatible with network manager.
– guntbert
Jun 8 '13 at 21:34
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
it;s incompatible. YOu can follow help.ubuntu.com/community/WICD
– tr33hous
Mar 1 '14 at 23:43
add a comment |
I use wicd-curses
, which I find to be the easiest user interface by far.
You need to use the → (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.
Of course you need to find some way of getting on the internet without wicd
; I'm assuming you have already solved that or else you wouldn't be posting.
(This is not timely to the OP, just posting for posterity since this question still comes up on Google. To the google-seekers: if you're reading this from a café or friend's computer or something, maybe you can use a wire somewhere to get wicd-curses
installed with sudo apt-get install wicd-curses
; then make sure you test it out on a network that's known to work before leaving!)
add a comment |
I use wicd-curses
, which I find to be the easiest user interface by far.
You need to use the → (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.
Of course you need to find some way of getting on the internet without wicd
; I'm assuming you have already solved that or else you wouldn't be posting.
(This is not timely to the OP, just posting for posterity since this question still comes up on Google. To the google-seekers: if you're reading this from a café or friend's computer or something, maybe you can use a wire somewhere to get wicd-curses
installed with sudo apt-get install wicd-curses
; then make sure you test it out on a network that's known to work before leaving!)
add a comment |
I use wicd-curses
, which I find to be the easiest user interface by far.
You need to use the → (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.
Of course you need to find some way of getting on the internet without wicd
; I'm assuming you have already solved that or else you wouldn't be posting.
(This is not timely to the OP, just posting for posterity since this question still comes up on Google. To the google-seekers: if you're reading this from a café or friend's computer or something, maybe you can use a wire somewhere to get wicd-curses
installed with sudo apt-get install wicd-curses
; then make sure you test it out on a network that's known to work before leaving!)
I use wicd-curses
, which I find to be the easiest user interface by far.
You need to use the → (right arrow key ->
) to set configurations; everything else is obvious from the on-screen instructions.
Of course you need to find some way of getting on the internet without wicd
; I'm assuming you have already solved that or else you wouldn't be posting.
(This is not timely to the OP, just posting for posterity since this question still comes up on Google. To the google-seekers: if you're reading this from a café or friend's computer or something, maybe you can use a wire somewhere to get wicd-curses
installed with sudo apt-get install wicd-curses
; then make sure you test it out on a network that's known to work before leaving!)
answered May 19 '15 at 14:45
isomorphismesisomorphismes
86721228
86721228
add a comment |
add a comment |
protected by Pilot6 Nov 14 '15 at 9:17
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
2
If you are going to be messing with your system's network connection manager, I recommend that you do so while connected via wired ethernet, which is less likely to lose its connection, and easier to set up from the command line, should the need arise.
– Ryan Thompson
May 19 '11 at 20:03
I use
wicd-curses
, which I find to be the easiest user interface by far. You need to use the <kbd>→</kbd> (right arrow key->
) to set configurations; everything else is obvious from the on-screen instructions.– isomorphismes
May 19 '15 at 14:43