SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-02-14 16:40:34

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Debian wifi netinstall - win a free internet

There are lots of how-tos available for getting a wifi connection from the command line.  However, there's a problem - they have too much stuff and assume the viewer can parse the wheat from the chaff.  This thread is an attempt to break this down to exactly what you need for what hardware you have.  If your wifi situation isn't yet described in this thread, please post what you have to do to win an internet for the benefit of others.

This assumes you already know that you have wpa/wpa2-psk security and you know the ssid ("wifi hotspot", as the kids say) and passphrase of a WPA2 wireless router, but the Debian Installer reported that "no default route was set" during its initial network configuration.

First, become root.  Once you perform the next step, you need to be root (and not just acting as root via sudo) to access /etc/network/interfaces.

$ sudo su

Change rights of /etc/network/interfaces to prevent publicly-shared key disclosure:

# sudo chmod 0600 /etc/network/interfaces

Use wpa_passphrase to generate a hexcode from your router's ssid and "secret" passphrase:

# wpa_passphrase myssid my_very_secret_passphrase >> /etc/network/interfaces

As you can see, this will add a few lines to /etc/network/interfaces.  (If you don't understand command line redirection enough to see this, you might want to install something from a LiveISO and read up on bash scripting.  Ignorance isn't a bad thing, it's just an opportunity to learn.)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback
network={
	ssid="myssid"
	#psk="my_very_secret_passphrase"
	psk=56a66165145c85183600a63d04f6cd4779ed59a542d14195be3d6e44d15cdc5b
}

This requires a little editing before ia/ifup will be able to read it.  Change it so it looks like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid myssid
        wpa-psk 56a66165145c85183600a63d04f6cd4779ed59a542d14195be3d6e44d15cdc5b

Don't forget to remove the brace in the last line.

Bring up wlan0:

# ifup wlan0

You should see something like this:

Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/bc:85:56:e5:d9:35
Sending on   LPF/wlan0/bc:85:56:e5:d9:35
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.2.1
DHCPACK from 192.168.2.1
bound to 192.168.2.5 -- renewal in 2147483648 seconds.

Exit from the root account.  Congratulations - you win one internet.

Last edited by pvsage (2015-02-14 23:16:00)

Offline

Help fund CrunchBang, donate to the project!

#2 2015-02-14 23:14:11

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Debian wifi netinstall - win a free internet

Now that you have an internet, you can continue with your netinstall.  Add a Debian mirror to /etc/apt/sources.list, perform your update, dist-upgrade, and install apt-listbugs and enough of a GUI environment (LightDM, Openbox, network-manager-gnome/Wicd, tint2) so you don't need the command line to get an internet (Debian recommends allowing a GUI tool to manage your network if you typically live in GUI), remove the wlan0 ssid stanzas from /etc/network/interfaces, reboot your system and login.  Launch tint2 from a terminal emulator if necessary; the network manager applet should already be in the systray, waiting for you to configure your graphical internet.

Offline

#3 2015-02-15 03:02:47

AnInkedSoul
#! CrunchBanger
Registered: 2010-06-30
Posts: 232

Re: Debian wifi netinstall - win a free internet

If you are just using your wifi at home, not changing networks, then a network GUI is really superfluous.


As root add the following to /etc/network/interfaces

auto wlan0
iface wlan0 inet dhcp
wpa-ssid mynetwork
wpa-psk mypassword

then either reboot, or ifup wlan0, or /etc/init.d/networking restart




Be careful when using apt-listbugs, I have seen users with so many blocked packages that are so far out of date that fully upgrading requires a lot of work.

Offline

#4 2015-02-15 03:13:25

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Debian wifi netinstall - win a free internet

^ Good point - nice suggestion.

I've read that either the psk or the hexkey will work for "mypassword", but I feel a little more secure in the latter; isn't the psk sent "in the clear"?

Offline

#5 2015-02-15 03:41:23

AnInkedSoul
#! CrunchBanger
Registered: 2010-06-30
Posts: 232

Re: Debian wifi netinstall - win a free internet

nah...a password gets hashed along with your SSID to make a key that is used for communicaton with the access point

but if anyone is that adept at packet sniffing and using the data as an attack vector then you are already screwed and if you are that paranoid then I suggest you disable your wireless devices and go get a really big roll of cat5.....right now.....go....
smile

Offline

#6 2015-02-15 03:45:58

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: Debian wifi netinstall - win a free internet

Just make sure tkip is disable on your router as I read that it defaults you back to wep. What I mean is alot of routers have a setting AES + TKIP, which allows for a wep attack vector. Set it to AES only and let them have fun attempting to crack it. Having studied this subject a bit AES + non-dictionary passwords should be sufficient.

Offline

#7 2015-02-15 03:56:55

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Debian wifi netinstall - win a free internet

@AnInkedSoul:  LOL no, not really paranoid, and not too worried about packet sniffing here in hicksville.  To tell the truth, I'm more worried about meatspace security/safety matters...which are completely off-topic for this thread, but it's always good to keep things in perspective.

Offline

#8 2015-02-17 23:41:38

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Debian wifi netinstall - win a free internet

Warning: Tonight we will be using systemd to connect -- look away now if you disapprove...

Firstly, create a wpa_supplicant configuration file for your wireless connection point(s):

sudo tee /etc/wpa_supplicant/wpa_supplicant.conf <<< "ctrl_interface=DIR=/run/wpa_supplicant"
sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf <<< $(wpa_passphrase <SSID> <password>)

Where <SSID> is the name of the connection point and <password> is the, er, password.

Repeat the second line for all the desired connection points (these can be added later if needed).

Then write the systemd unit file (as root):

[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/sbin/ip link set dev %i up
ExecStart=/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
ExecStart=/sbin/dhclient %i

ExecStop=/sbin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

Save this file as /etc/systemd/system/network-wireless@.service

Now enable this .service to start at the next boot using:

sudo systemctl enable network-wireless@wlan0.service

If your wireless interface is not called "wlan0", change that to the actual interface name.

Now make sure all other networking programs are disabled -- comment out the wlan0 lines in /etc/network/interfaces if you're using @pvsage's method described above.

Reboot.

Thank you and goodnight!
smile

Last edited by Head_on_a_Stick (2015-02-17 23:49:12)

Offline

#9 2015-04-18 17:20:08

w4rr4n7
New Member
Registered: 2015-03-08
Posts: 8

Re: Debian wifi netinstall - win a free internet

This has been an issue for me for a long time. My Samsung ativ book 9 lite just won't do anything linux the easy way. I had to run ifup wlan0 AND reboot. I'd always just get stuck after running ifup and seeing that I should have a connection but every ping or apt-get update attempt failed. Just had to restart it AFTER running ifup wlan0.

Thanks yall

Last edited by w4rr4n7 (2015-04-18 17:20:23)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo