| 95 | |
| 96 | == 6. Setting up WiFi Access on Router == |
| 97 | |
| 98 | The following instructions assume a Debian derivative Linux distro. |
| 99 | {{{ |
| 100 | # Install required packages |
| 101 | # ------------------------- |
| 102 | |
| 103 | sudo apt-get -qq -y install hostapd dnsmasq |
| 104 | |
| 105 | |
| 106 | # Bring up driver for the local wifi adaptor |
| 107 | # ------------------------------------------ |
| 108 | |
| 109 | # If the wifi interface is not up already, you can use tools such as 'lspci' |
| 110 | # or 'lsusb' to find which wifi adaptor is installed and load the appropriate |
| 111 | # driver. E.g., for all Atheros IEEE 802.11n PCI/PCI-Express and AHB WLAN based |
| 112 | # chipsets use the 'ath9k' driver. |
| 113 | sudo modprobe ath9k |
| 114 | |
| 115 | # To determine which interface came up from above driver action, check using |
| 116 | sudo ifconfig -a |
| 117 | |
| 118 | # Note: if your node uses NetworkManager to manage an active Internet connection |
| 119 | # (e.g., if you are using a laptop to run as an access router), you may have to |
| 120 | # disable this daemon first and activate the device if blocked: |
| 121 | sudo nmcli nm wifi off |
| 122 | sudo rfkill unblock wlan |
| 123 | |
| 124 | |
| 125 | # Configure interface |
| 126 | # ------------------- |
| 127 | |
| 128 | # bring up WiFi interface with IP and netmask. This will be the AP's IP. |
| 129 | sudo ifconfig wlan0 192.168.1.1 netmask 255.255.255.0 up |
| 130 | |
| 131 | |
| 132 | # Set up DHCP (optional) |
| 133 | # ---------------------- |
| 134 | |
| 135 | # Edit DHCP configuration in /etc/dnsmasq.conf to alter interface, IP range, |
| 136 | # and to add any particular MAC-IP assignment bindings to be enforced |
| 137 | # See sample configuration in section below. |
| 138 | sudo vi /etc/dnsmasq.conf |
| 139 | |
| 140 | # restart DHCP service: |
| 141 | sudo service dnsmasq restart |
| 142 | |
| 143 | |
| 144 | # Configure and Bringup hostapd |
| 145 | # ----------------------------- |
| 146 | |
| 147 | # Create/edit a hostapd.conf (sample shown below) to configure interface, essid, |
| 148 | # channel, passphrase etc., for the AP. Using '/etc/hostapd/hostapd.conf' as |
| 149 | # the location makes it convenient for automation |
| 150 | sudo vi /etc/hostapd/hostapd.conf |
| 151 | |
| 152 | # To automate initialization, edit '/etc/default/hostapd' to uncomment and set |
| 153 | # DAEMON_CONF to the absolute path of your hostapd configuration file. This also |
| 154 | # enables hostapd to be started at boot. |
| 155 | sudo vi /etc/default/hostapd |
| 156 | |
| 157 | #DAEMON_CONF="/etc/hostapd/hostapd.conf" |
| 158 | |
| 159 | # To start, stop, restart hostapd: |
| 160 | sudo /etc/init.d/hostapd {start|stop|restart} |
| 161 | |
| 162 | # or use 'service' tool |
| 163 | sudo service hostapd {start|stop|restart} |
| 164 | |
| 165 | # Here's the manual way to bring up hostapd if needed (-B sets background mode): |
| 166 | sudo hostapd -BtKd /etc/hostapd/hostapd.conf |
| 167 | }}} |
| 168 | |
| 169 | === Sample hostapd Configuration === |
| 170 | {{{ |
| 171 | interface=wlan0 |
| 172 | driver=nl80211 |
| 173 | ssid=mfaccess-test |
| 174 | # hw_mode: always a subset of a, b, g |
| 175 | hw_mode=g |
| 176 | channel=11 |
| 177 | macaddr_acl=0 |
| 178 | auth_algs=1 |
| 179 | ignore_broadcast_ssid=0 |
| 180 | # wpa=3 enables wpa & wpa2 |
| 181 | wpa=3 |
| 182 | wpa_passphrase=mfaccess-test |
| 183 | wpa_key_mgmt=WPA-PSK |
| 184 | wpa_pairwise=TKIP |
| 185 | rsn_pairwise=CCMP |
| 186 | }}} |
| 187 | |
| 188 | Refer to the [http://wireless.kernel.org/en/users/Documentation/hostapd hostapd documentation] for further details. |
| 189 | === Sample Dnsmasq Configuration === |
| 190 | {{{ |
| 191 | interface=wlan0 |
| 192 | # dhcp-range=<startIP>, <endIP>,<lease time> |
| 193 | dhcp-range=192.168.1.128,192.168.1.254,24h |
| 194 | dhcp-host=aa:22:bb:44:cc:66,192.168.1.128 |
| 195 | }}} |
| 196 | === Bringing up Access Router === |
| 197 | Now that the wireless interface is setup for clients to connect and authenticate, bring up MobilityFirst access router as show in router configurations page |