|
|
# installation : Wi-Fi
|
|
|
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
|
[<http://wireless.kernel.org/en/users/Documentation/modes>]
|
|
|
|
|
|
|
|
|
## AP: Debian
|
|
|
|
|
|
# apt-get install hostapd crda iw [dnsmasq]
|
|
|
|
|
|
# nano /etc/default/crda
|
|
|
[replace]
|
|
|
REGDOMAIN=CH
|
|
|
# zcat /usr/share/doc/hostapd/examples/hostapd.conf.gz >/etc/hostapd/hostapd.conf
|
|
|
# nano /etc/hostapd/hostapd.conf
|
|
|
[add after
|
|
|
##### hostapd configuration file ##############################################]
|
|
|
### <http://wireless.kernel.org/en/users/Documentation/hostapd>
|
|
|
### <http://forum.doozan.com/read.php?2,6300>
|
|
|
[replace]
|
|
|
ssid=$SSID
|
|
|
[uncomment]
|
|
|
country_code=CH
|
|
|
[uncomment]
|
|
|
ieee80211d=1
|
|
|
[si 802.11n:
|
|
|
[uncomment]
|
|
|
wmm_enabled=1
|
|
|
[uncomment]
|
|
|
ieee80211n=1
|
|
|
[replace, check values in `iw list` output]
|
|
|
ht_capab=[HT40+][SHORT-GI-40]
|
|
|
]
|
|
|
[uncomment, WPA+WPA2]
|
|
|
wpa=3
|
|
|
[uncomment]
|
|
|
wpa_passphrase=$PASSWORD
|
|
|
[uncomment]
|
|
|
wpa_pairwise=TKIP CCMP
|
|
|
rsn_pairwise=CCMP
|
|
|
# nano /etc/dnsmasq.conf
|
|
|
[if needed:
|
|
|
[either:
|
|
|
[add]
|
|
|
interface=wlan0
|
|
|
[:]
|
|
|
[add]
|
|
|
except-interface=eth0
|
|
|
]
|
|
|
[add new dhcp-range for wlan0]
|
|
|
]
|
|
|
# nano /etc/rc.local
|
|
|
[if needed:
|
|
|
[add before `exit 0`]
|
|
|
--8<---------------cut here---------------start------------->8---
|
|
|
# Forward local traffic to the Internet
|
|
|
### module:ipt_MASQUERADE needed for MASQUERADE
|
|
|
/sbin/iptables -t nat -A POSTROUTING -o eth0 -s $WLAN_SUBNET/24 -j MASQUERADE
|
|
|
|
|
|
--8<---------------cut here---------------end--------------->8---
|
|
|
]
|
|
|
# /etc/rc.local
|
|
|
# nano /etc/network/interfaces
|
|
|
[add at the end]
|
|
|
--8<---------------cut here---------------start------------->8---
|
|
|
# The Wi-Fi network interface
|
|
|
allow-hotplug wlan0
|
|
|
iface wlan0 inet static
|
|
|
address $IP/$SUBNET
|
|
|
hostapd /etc/hostapd/hostapd.conf
|
|
|
--8<---------------cut here---------------end--------------->8---
|
|
|
# ifup wlan0
|
|
|
# ip a s
|
|
|
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
|
|
|
link/ether $MAC brd ff:ff:ff:ff:ff:ff
|
|
|
inet 192.168.$SUBNET.$IP/24 brd 192.168.$SUBNET.255 scope global wlan0
|
|
|
4: mon.wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
|
|
|
link/ieee802.11/radiotap $MAC brd ff:ff:ff:ff:ff:ff
|
|
|
# pgrep -fl hostapd
|
|
|
$PID /usr/sbin/hostapd -B -P /var/run/hostapd.wlan0.pid /etc/hostapd/hostapd.conf
|
|
|
[test]
|
|
|
# etckeeper commit 'hostapd/hostapd.conf: new file'
|
|
|
|
|
|
|
|
|
## AP: OpenWrt
|
|
|
|
|
|
*[general]*
|
|
|
|
|
|
$ telnet 192.168.1.1
|
|
|
root@OpenWrt:/# scp $USER@$IP:/path/to/inubo/commun/Realisation/inubo/default-user/ssh/authorized_keys /etc/dropbear/
|
|
|
root@OpenWrt:/# passwd
|
|
|
Changing password for root
|
|
|
New password:
|
|
|
Retype password:
|
|
|
Password for root changed by root
|
|
|
[à sauver dans inubo/commun/Realisation/inubo/inubo.kdb]
|
|
|
root@OpenWrt:/# exit
|
|
|
$ ssh root@192.168.1.1
|
|
|
root@192.168.1.1's password:
|
|
|
root@OpenWrt:~# dropbearkey -f /etc/dropbear/dropbear_rsa_host_key -y
|
|
|
Fingerprint: md5 NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN:NN
|
|
|
[à sauver dans inubo/commun/Realisation/inubo/default-user/ssh/config]
|
|
|
|
|
|
*[disable odhcpd]*
|
|
|
|
|
|
root@OpenWrt:~# vi /etc/config/dhcp
|
|
|
[replace in
|
|
|
config odhcpd 'odhcpd']
|
|
|
## <http://wiki.openwrt.org/doc/techref/odhcpd>
|
|
|
option maindhcp '0'
|
|
|
root@OpenWrt:~# /etc/init.d/odhcpd disable
|
|
|
root@OpenWrt:~# /etc/init.d/odhcpd stop
|
|
|
|
|
|
*[configure network]*
|
|
|
|
|
|
root@OpenWrt:~# vi /etc/config/network
|
|
|
[replace in
|
|
|
config interface 'lan']
|
|
|
option ipaddr '$IP'
|
|
|
option netmask '255.255.255.0'
|
|
|
## <http://wiki.openwrt.org/doc/uci/network>
|
|
|
option gateway '$GATEWAY'
|
|
|
option dns '$DNS'
|
|
|
root@OpenWrt:~# vi /etc/config/system
|
|
|
[replace in
|
|
|
config system]
|
|
|
option hostname 'wifi-$LOCATION'
|
|
|
## <http://wiki.openwrt.org/doc/uci/system#time.zones>
|
|
|
option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
|
|
|
root@OpenWrt:~# reboot
|
|
|
$ ssh root@$IP
|
|
|
root@$IP's password:
|
|
|
|
|
|
*[AP]*
|
|
|
|
|
|
root@$HOSTNAME:~# vi /etc/config/wireless
|
|
|
[comment in
|
|
|
config wifi-device 'radio0']
|
|
|
#option disabled 1
|
|
|
[replace in
|
|
|
config wifi-iface]
|
|
|
## <http://wiki.openwrt.org/doc/uci/wireless>
|
|
|
option mode 'ap'
|
|
|
option ssid '$SSID'
|
|
|
option encryption 'psk2'
|
|
|
option key '$PASSPHRASE'
|
|
|
root@$HOSTNAME:~# wifi down
|
|
|
root@$HOSTNAME:~# wifi up
|
|
|
|
|
|
*[- CRDA, si pas automatique]*
|
|
|
|
|
|
root@$HOSTNAME:~# vi /etc/config/wireless
|
|
|
[add in
|
|
|
config wifi-device]
|
|
|
option country CH
|
|
|
root@$HOSTNAME:~# wifi down
|
|
|
root@$HOSTNAME:~# wifi up
|
|
|
|
|
|
*[- si nécessaire: canal]*
|
|
|
|
|
|
root@$HOSTNAME:~# vi /etc/config/wireless
|
|
|
[replace in
|
|
|
config wifi-device]
|
|
|
option channel N
|
|
|
root@$HOSTNAME:~# wifi down
|
|
|
root@$HOSTNAME:~# wifi up |