734a735,1077
>
> Wireless Client Configuration
>
> Wireless Fidelity (WiFi) enable a Debian machine to connect
> to a wireless access point (AP) such as a router. In Debian, there
> are two ways of connecting to an AP. The first is manual configuration.
> While manually configuring a wireless interface involves more work and
> resets after every reboot, it works on all Linux distributions and
> is important to know when troubleshooting wireless issues. Manually
> configuring a wireless client can be broken into three steps:
> ensure the wireless interface is detected and functional, connect
> and authenticate to the AP, and obtain an IP address.
>
>
> In order for a wireless device to be detected by Debian, the
> kernel must have support for the device and the correct firmware
> needs to be installed. To determine if the wireless interface is
> detected, run lsusb for a usb based wireless adapter or lspci for
> a pci based wireless adapter.
>
>
>
> Example lsusb output
>
> root@~-> lsusb
> ...
> Bus 001 Device 002: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
> ...
>
>
>
> The wireless interface should be listed in the output of ip addr.
>
> Example ip addr output
>
> root@~-> ip addr
> 1: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
> link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
>
>
>
> If your wireless device is not listed in either lsusb/lspci
> or ip addr, then the device is not being detected by the kernel.
> Most likely, the kernel does not have support compiled in for the
> wireless device. To enable support, you will need to compile a custom
> kernel. In the kernel configuration menu, go to Device Drivers ->
> Network Device Support -> Wirless LAN and enable the drivers needed
> for your wireless device. There may also be wireless drivers in
> Device Drivers -> Staging Drivers. Some wireless chipsets
> (such as for the RT5370 device in the example output) require closed
> source firmware. To install this firmware, enable the non-free
> repository in /etc/apt/sources.list, run apt-get update, and install
> the firmware required. For the specific RT5370 chipset in the example,
> the firmware-ralink package is needed. To find information about your
> specific wireless chipset, see https://wiki.debian.org/WiFi.
>
>
> Now that the wireless interface is detected by the kernel,
> it can be connected to an AP. As an example, "wlan0" will be the
> wireless interface name, "AP" will be the name of the AP to connect
> to, "qwert" will be the password for the WEP AP and "password"
> will be the password for the WPA AP. Adjust accordingly.
>
>
> Set the wireless interface up
>
> Set interface up
>
> root@~-> ip link set wlan0 up
>
>
>
> An AP can require one of three authentication methods: open,
> WEP, and WPA. Open authentication require no authentication at all;
> any client within range can connect to an open AP.
> WEP encryption is obsolete and can be broken in a matter of minutes.
> While WEP should never be used to secure an AP, it is included here
> for completeness. WPA is the prefered method of authentication for an AP.
>
>
>
> For open authentication
>
> root@~-> iwconfig wlan0 essid AP
>
>
>
>
> For WEP authentication
>
> root@~-> iwconfig wlan0 essid AP key s:qwert
>
>
>
>
> For WPA authentication
>
> root@~-> #Generate a configuration with
> root@~-> wpa_passphrase AP password > /etc/wpa_supplicant.conf
> root@~-> #Connect to the access point with
> root@~-> wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
> root@~-> #This may generate some warnings that can be ignored for now.
>
>
>
> The wireless interface now needs to obtain an ip address.
>
> For a static IP address
>
> root@~-> #Replace 192.168.1.2 with the desired ip address
> root@~-> #and /24 with the required netmask.
> root@~-> ip addr add 192.168.1.2/24 dev wlan0
>
>
>
> For a DHCP IP address
>
> root@~-> dhcpcd wlan0
>
>
>
> The client is now connected to the AP. However, the kernel has
> not been configured to use this as the default route. To make the
> wireless interface the default, execute
>
>
> Set default route
>
> root@~-> #Replace 192.168.1.1 with the IP address of your gateway
> root@~-> ip route del default via 192.168.1.1
> root@~-> ip route add default via 192.168.1.1 dev wlan0
>
>
>
> The client is now connected. If pinging an ip address such as
> 8.8.8.8 works, but pinging a hostname such as google.com does not,
> then adjust /etc/resolv.conf to include the domain and nameserver.
>
>
> A wireless interface can also be configured using
> /etc/network/interfaces. This method is simpler than manual configuration
> and is automatically setup on every boot. The examples below will need
> to be changed according to the network setup. Note that in order for
> the wireless interface to be the default route, it must come before
> other entries in /etc/network/interfaces. For the examples below,
> choose either the static or dhcp configuration.
>
>
>
> For an open AP
>
> #DHCP configuration
> auto wlan0
> iface wlan0 inet dhcp
> wireless-essid AP
>
> #Static configuration
> auto wlan0
> iface wlan0 inet static
> address 192.168.1.2
> netmask 255.255.255.0
> gateway 192.168.1.1
> broadcast 192.168.1.255
> network 192.168.1.0
> wireless-essid AP
>
>
>
>
> For a WEP AP
>
> #DHCP configuration
> auto wlan0
> iface wlan0 inet dhcp
> wireless-essid AP
> wireless-key s:qwert
>
> #Static configuration
> auto wlan0
> iface wlan0 inet static
> address 192.168.1.2
> netmask 255.255.255.0
> gateway 192.168.1.1
> broadcast 192.168.1.255
> network 192.168.1.0
> wireless-essid AP
> wireless-key s:qwert
>
>
>
>
> For a WPA AP
>
> #DHCP configuration
> auto wlan0
> iface wlan0 inet dhcp
> wpa-conf /etc/wpa_supplicant.conf
>
> #Static configuration
> auto wlan0
> iface wlan0 inet static
> address 192.168.1.2
> netmask 255.255.255.0
> gateway 192.168.1.1
> broadcast 192.168.1.255
> network 192.168.1.0
> wpa-conf /etc/wpa_supplicant.conf
>
>
>
> Finally, restart the network
>
> Restart the network
>
> root@~-> systemctl restart network
>
>
> The wireless interface is now configured and will be activated
> on every boot.
>
>
>
>
>
>
> Wireless Access Point Configuration
>
> Running a wireless access point (AP) on Debian allows
> wireless clients to connect. This can be useful for
> setting up a wireless router or creating a local wireless network.
>
>
> In addition to ensuring that the wireless device is detected
> by the kernel, the device must also support AP mode. To check if your
> device does, run
>
>
>
> Check for AP mode
>
> root@~-> iw phy
> ...
> software interface modes (can always be added):
> * AP/VLAN
> ...
>
>
>
> If the wireless device supports AP mode, then there should
> be an "AP/VLAN" entry under "software interface modes." If there is no such
> entry, then the wireless device cannot act as an access point.
>
>
> Install hostapd and open a file named /etc/hostapd/hostapd.conf.
> Change "wlan0" to your wireless interface name and "MYNET" to the
> desired network name. The configurations below are templates. For more
> information about configuring hostapd, see
> https://wireless.wiki.kernel.org/en/users/Documentation/hostapd
>
>
>
> For an open AP
>
> interface=wlan0
> driver=nl80211
> ssid=MYNET
> hw_mode=g
> channel=6
> auth_algs=1
>
>
>
>
> For a WEP AP
>
> interface=wlan0
> driver=nl80211
> ssid=MYNET
> hw_mode=g
> channel=6
> auth_algs=2
> wep_default_key=0
> wep_key0="qwert"
>
>
>
>
> NOTE WEP Key Length
> Due to how WEP functions, passwords can only be
> 5 or 13 charachters long. Any other length is invalid and
> hostapd will fail to start.
>
>
>
>
> For a WPA AP
>
> interface=wlan0
> driver=nl80211
> ssid=MYNET
> hw_mode=g
> channel=6
> auth_algs=1
> wpa=3
> wpa_passphrase=password
> wpa_key_mgmt=WPA-PSK
> wpa_pairwise=TKIP
> rsn_pairwise=CCMP
>
>
>
> Start the AP.
>
> Start the AP
>
> root@~-> hostapd /etc/hostapd/hostapd.conf
>
>
>
> Finally, assign a static IP address so that connected client
> can directly connect to the AP.
>
> Add static IP
>
> root@~-> ip addr add 192.168.1.1/24 dev wlan0
>
>
>
> The wireless access point is now setup. A dhcp server
> such as dnsmasq can be setup on the wireless interface to handle
> dhcp clients.
>
>
>
> NOTE Troubleshooting
> If you encounter any problems in setting up the AP,
> ensure that the IP subnet is not already in use.
> For example, if a local wireless network is operating on the
> 192.168.1.x subnet, your AP should operate under a different
> subnet.
>
>
>
735a1079
>