Maximum PC

BUILDING BRIDGES

-

Our main tutorial leads you to building, essentiall­y, a self-contained network. One with its own subnet, its own range of IP addresses, and its own DHCP management. Devices you connect to it gain access to the Internet, and you get pinpoint control, but its isolated structure may not be entirely ideal. Building a network bridge instead leaves a lot of that hard work up to your router, and makes your access point far more of an extension of your existing network than a mini network unto itself.

We still need hostapd to deal with the wireless authentica­tion side of things, as well as Debian’s bridge-utils package, installed via sudo apt-get install hostapd bridge-utils . Stop hostapd ( sudo

systemctl stop hostapd ), then open up the dhcpcd configurat­ion file for editing with

sudo nano /etc/dhcpcd.conf . Because our bridge will be the logical network device, rather than either the Pi’s Ethernet or WiFi modules, we now need to stop them from receiving their own IP addresses by adding denyinterf­aces wlan0 and

denyinterf­aces

eth0 to the end of the file, on separate lines. Save the file and exit back to the shell.

Now we’ll add our bridge—again, this is virtual network hardware, the Pi acting as a go-between for our network ports—by typing sudo brctl

addbr br0 , and then connect it to our Ethernet port with sudo brctl addif br0

eth0 . With the two hooked up, we need to define the bridge interface a little more clearly by running sudo nano /etc/

network/interfaces . Scroll down to the bottom of the file (there’s a good chance it won’t be too long), and add the following definition­s line by line. First, auto br0 to bring the interface up at boot time, then

iface br0 inet manual to tell the bridge that we want the router’s DHCP service to deal with assigning it an IP address. Finally, bridge_ports eth0 wlan0 tells the bridge precisely what you want it to do—that is, sit between the Ethernet and Wi-Fi devices, and bridge all network ports between them.

The final step, once the interfaces file is saved, is to open up /etc/hostapd/ hostapd.conf and write your configurat­ion file. Follow the steps under “Set up hostapd” in the main tutorial, but instead of including the line driver=nl80211 , drop in bridge=br0 , telling your access point to connect you to the bridge adapter. Save, reboot, and use ifconfig to test whether your bridge is now active; it should be the only device assigned an IP address.

 ??  ??

Newspapers in English

Newspapers from United States