From charlesreid1

The goal of this writeup was to have two wifi interfaces for Bespin: one to connect to the home network, and the other to run a repeater for the home network. We could probably do both functions with one network card, but I'm sick of dealing with dumb wifi issues. I just want something working.

Here is the setup:

  • wlan0 is the wifi device that connects to the home network (192.168.0.x)
  • wlan1 is the wifi device that runs a hostapd wifi network with same auth info and IP space as the original router
  • br0 bridges wlan0 and wlan1 so that devices on both wifi networks can talk to each other

Make sure hostapd is installed, then install bridge utils:

sudo aptitude install hostapd bridge-utils

Set the hostapd configuration file:

/etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Create the hostapd config file, and set up an SSID and passphrase that match the home network (not necessary, but allows clients to connect to whatever access point is the strongest automatically):

/etc/hostapd/hostapd.conf

# Set this to wlan0 if you are using an ethernet cable
# to connect your Pi to the internet
interface=wlan1
driver=nl80211
hw_mode=g
channel=1
macaddr_acl=0
ignore_broadcast_ssid=0

ssid=home_network
wpa_passphrase=same_passphrase_as_home_network
auth_algs=1
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Now configure the bridge in the network interfaces file:

/etc/network/interfaces

auto br0
iface br0 inet static
    address 192.168.0.x
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.1.255
    gateway 192.168.0.1
    bridge-ports wlan0 wlan1

Now you can start the hostapd service:

sudo service hostapd start