The Broadcom bcm2835, onboard Raspberry Pi 3, can be configured as an access point, wifi client, and router, comprising a wifi router or repeater.
To apply this procedure to configure a Raspberry Pi 3 as a wifi router or repeaer.
iw list # ... # Supported interface modes # IBSS # managed # AP # monitor # P2P-client # P2P-GO # P2P-device # ... # Frequencies ... 24xx MHz ... 5xxx MHz # # interface combinations are not supported # valid interface combinations: # * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1, # total <= 3, #channels <= 2 # * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1, # total <= 4, #channels <= 1 # ...
cat <<EOF | sudo tee -a /etc/hosts # Raspbian repository 93.93.128.193 mirrordirector.raspbian.org 208.69.120.55 mirror.nexcess.net EOF
sudo /sbin/route add default gw 192.168.1.254
sudo apt-get install hostapd dnsmasq udhcpd
cat <<EOF | sudo tee /etc/hostapd/hostapd.conf interface=wlan0 driver=nl80211 ssid=WIFINAME hw_mode=g channel=6 # 1, 6, or 12 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=PASSWORD wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP # You better do not use this weak encryption (only used by old client devices) rsn_pairwise=CCMP # The following are peculiar to Raspberry Pi ieee80211n=1 # 802.11n support wmm_enabled=1 # QoS support ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] EOF
cat <<EOF | sudo tee /etc/dnsmasq.conf interface=wlan0 driver=nl80211 ssid=WIFINAME hw_mode=g channel=6 # 1, 6, or 12 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=PASSWORD wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP # You better do not use this weak encryption (only used by old client devices) rsn_pairwise=CCMP # The following are peculiar to Raspberry Pi ieee80211n=1 # 802.11n support wmm_enabled=1 # QoS support ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] EOF
cat <<EOF | sudo tee /etc/hosts.dnsmasq ... 192.168.7.1 raspberrypi-or-myhostnam raspberrypi-or-myhostnam.mydomain ... EOF
sudo mv /etc/udhcpcd.conf{,.orig} sudo cp /etc/udhcpcd.conf{.orig,} sudo vi /etc/udhcpd.conf diff /etc/udhcpcd.conf{.orig,} ... # The start and end of the IP lease block - start 192.168.0.20 #default: 192.168.0.20 - end 192.168.0.254 #default: 192.168.0.254 + start 192.168.3.192 #default: 192.168.0.20 + end 192.168.3.253 #default: 192.168.0.254 ... # The interface that udhcpd will use - interface eth0 #default: eth0 + interface wlan0 #default: eth0 ... - opt dns 192.168.10.2 192.168.10.10 option subnet 255.255.255.0 - opt router 192.168.10.2 - opt wins 192.168.10.10 - option dns 129.219.13.81 # appened to above DNS servers for a total of 3 - option domain local + opt dns 192.168.3.1 + opt router 192.168.3.1 + option domain localnet ... sudo mv /etc/default/udhcpd{,.orig} sudo cp /etc/default/udhcpd{.orig,} sudo vi /etc/default/udhcpd diff /etc/default/udhcpd{.orig,} ... # Comment the following line to enable - DHCPD_ENABLED="no" + # DHCPD_ENABLED="no" ...
cat <<EOF | sudo tee /etc/network/interfaces.d/012_wlan0ap # Enable wifi at boot auto wlan0 iface wlan0 inet static address 192.168.3.1 netmask 255.255.255.0 network 192.168.3.0 broadcast 192.168.3.255 EOF
cat <<EOF | sudo tee /etc/network/interfaces.d/013_wlan1 # Enable wifi at boot auto wlan1 iface wlan1 inet static wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf address 192.168.4.68 netmask 255.255.255.0 EOF
sudo mkdir -p /etc/network/disabled_interfaces.d sudo mv /etc/network/{,disabled_}interfaces.d/nnn_obsolete/
sudo /sbin/route del default gw 192.168.1.254