Ubuntu – Changing adapter back to manged mode

wireless

I changed my adapter to monitor mode using:

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor 

Now, I cannot change it back (in the GUI, when I click on connections, it says that "wireless is disabled by wireless switch"). I have not switched off anything from hardware buttons.

I tried

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode managed 
sudo service network-manager restart

I also tried

pccardctl eject
pccardctl insert

It appears that it has switched back to managed mode, but is still offline:
ifconfig output:

 eth0      Link encap:Ethernet  HWaddr 00:24:21:6f:84:69  
           inet addr:10.100.1.41  Bcast:10.100.255.255  Mask:255.255.0.0
           inet6 addr: fe80::224:21ff:fe6f:8469/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:27668 errors:0 dropped:0 overruns:0 frame:0
           TX packets:3504 errors:0 dropped:0 overruns:0 carrier:0
           collisions:1 txqueuelen:1000 
           RX bytes:4493143 (4.4 MB)  TX bytes:659945 (659.9 KB)

 lo        Link encap:Local Loopback  
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:553 errors:0 dropped:0 overruns:0 frame:0
           TX packets:553 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0 
           RX bytes:84110 (84.1 KB)  TX bytes:84110 (84.1 KB)

iwconfig output:

 eth0      no wireless extensions.

 lo        no wireless extensions.

 wlan0     IEEE 802.11bg  ESSID:off/any  
           Mode:Managed  Access Point: Not-Associated   Tx-Power=off   
           Retry  long limit:7   RTS thr:off   Fragment thr:off
           Power Management:off

Best Answer

You should execute:

sudo ifconfig wlan0 up

And it should come back to life.

Just to give you a little explanation: the output of the command ifconfig only shows the interfaces that are up. For example, you'll notice that your eth0 interface is up:

eth0       Link encap:Ethernet  HWaddr 00:24:21:6f:84:69  
           inet addr:10.100.1.41  Bcast:10.100.255.255  Mask:255.255.0.0
           inet6 addr: fe80::224:21ff:fe6f:8469/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Your ifconfig output does not have wlan0 listed, meaning that it has been turned off. If you do ifconfig -a, you should see all interfaces (up or down), and you'll notice that wlan0 won't have UP displayed. And all of this makes complete sense because you switched off your WiFi card when you did ifconfig wlan0 down. So ifconfig wlan0 up should bring it back online. If it doesn't work straight away, do a sudo service network-manager restart.

Related Question