Cannot connect to network on Debian

21,627

Your tag indicates that you are trying to setup a wireless connection. This is not as straight-forward as connecting per cable. (You should try that first though - see Oleg's answer).

If you are using a wireless network card it is also likely you are running a notebook. You then should install a desktop (like GNOME, Cinnamon, KDE,...) and use the network-manager. (But you did not provide any details on your setup, so I am just guessing.)

List your network devices. This should look something like this:

% lspci | grep -e "Ethernet\|Network"
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

You mentioned a Lenovo Thinkpad (which model?) which also should have a Intel wireless adapter. Unfortunately do the Intel wireless adapters not work out of the box in Debian/Jessie. You need the firmware-iwlwifi package from the non-free section.

Check your apt-sources for non-free first:

deb     http://http.debian.net/debian jessie main contrib non-free

(if you have a very new Thinkpad you might also have to activate jessie-backports).

And install firmware-iwlwifi:

apt-get install firmware-iwlwifi

Reboot you notebook and the wireless adapter should be visible in the network-manager in KDE.

But if you really want to go wireless by using the command line, here we go...

List your network devices. Should look like this:

% ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 3c:dd:0e:68:43:d4 brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether 8d:dd:4b:04:15:84 brd ff:ff:ff:ff:ff:ff

Bring up your wireless adapter:

ip link set wlan0 up

Find your wireless network (SSID):

iwlist wlan0 scanning
iwlist wlan0 scanning | grep ESSID # just shows the available SSIDs

I also assume you have WPA-PSK enabled so you must setup it up. Run

wpa_passphrase myessid secretsecret

and you'll get something like this:

network={
    ssid="myessid"
    #psk="secretsecret"
    psk=a022d0c8f88de93e4b53e5ee1c5d98cd4171a15bd44cde7499faa294ad795211
}

Then edit your /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid myessid
        wpa-psk a022d0c8f88de93e4b53e5ee1c5d98cd4171a15bd44cde7499faa294ad795211

Bring up the device with:

ifup wlan0

See:

HTH

Share:
21,627

Related videos on Youtube

ex8
Author by

ex8

Become the change you want to see.

Updated on September 18, 2022

Comments

  • ex8
    ex8 over 1 year

    I have been working on this new freshly installed Debian machine for quite some time now trying to get the network going so I have internet. During the installation process for the network configuration I said I'll "configure it later" as it couldn't do it on its own. So here I am.

    I have seen and tried this question + answer, but no luck

    Let's get to it.

    I am unable to ping anything and I can't do "apt-get" and it's frustrating as hell.

    My /etc/network/interfaces looks like this:

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    

    My /etc/resolv.conf contains:

    nameserver 192.168.1.1
    

    I am extremely stuck and don't know the next course of action as I cannot find a way to figure this out. Any help is highly appreciated.

    Thanks

    EDIT

    This is my ifconfig -a when I'm plugged in using an ethernet cable.

    eth0      Link encap:Ethernet  HWaddr 2c:60:0c:82:76:d7  
              inet addr:192.168.1.73  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::2e60:cff:fe82:76d7/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:5417 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1539 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:7425280 (7.0 MiB)  TX bytes:152728 (149.1 KiB)
    
    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:103 errors:0 dropped:0 overruns:0 frame:0
              TX packets:103 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:9013 (8.8 KiB)  TX bytes:9013 (8.8 KiB)
    
    • GAD3R
      GAD3R about 8 years
      Try to activate eth0 ip link set eth0 up and check the result ip link show dev eth0.
  • ex8
    ex8 about 8 years
    I first tried this as requested from dpat, when I type "ifdown eth0" I get the message: "ifdown: interface eth0 not configured"
  • ex8
    ex8 about 8 years
    Hello, thanks for the response. However I am running a Lenovo Thinkpad and I'm using KDE (as requested by from a friend). When I type "ip link", I only have the 1. lo and 2. eth0 showing up, I don't have wlan0 being displayed. How can I fix this?
  • Oleg Bolden
    Oleg Bolden about 8 years
    Well, check that you plugged an Ethernet cable to your PC and try ifconfig eth0 down. Then Ifup eth0. If nothing helps just reboot. And show ifconfig -a output, please.
  • ex8
    ex8 about 8 years
    Ok so its plugged in with an Ethernet cable and I tried it again and its working. How can I get it so I can connect to a wireless connection now? Btw thanks for the help!
  • Oleg Bolden
    Oleg Bolden about 8 years
    Not at all, thanks to all who answered here. Show ifconfig -a to see if there are a wlan interface and follow instructions from dpat to set it up.
  • ex8
    ex8 about 8 years
    I have added my output of "ifconfig -a" to the original post (it was too long for the comment box lol). Also I see no wlan interface :(. How do I add one?
  • Oleg Bolden
    Oleg Bolden about 8 years
    By the way, if you do not familiar to Linux, then you installed some desktop version of debian I guess. Desktop versions usually featured with something like Network Manager to ease network settings. May be you'd better to use graphical utilities rather then command line.
  • ex8
    ex8 about 8 years
    I am quite familiar with UNIX/Linux machines, however just not the network things as it's usually not an issue for me. Not in this case lol. I can't seem to find a Network Manager on my Debian machine. What wireless adapter should I install on my debian machine?
  • Oleg Bolden
    Oleg Bolden about 8 years
    I can not guess what hardware capabilities are there in you PC. If your PC doesn't have builtin Wi-Fi adapter so you need some USB one. All steps for configuring Wi-Fi adapters are described here (I'm just duplicating dpat's weblinks): wiki.debian.org/WiFi/HowToUse
  • dpat
    dpat about 8 years
    Which Lenovo Thinkpad do you have? You might need firmware-iwlwifi. I updated my answer.