chrissr
Posts: 1
Joined: Wed Apr 10, 2013 2:58 am

Bridge wifi network connection to second Pi over ethernet.

Wed Apr 10, 2013 3:11 am

Hi All,

I just received a second Pi. The first is running headless with a wifi network connection. My goal is to bridge the first Pi's network connection to the second via a direct ethernet connection between the two. Can anyone give me some direction on how to accomplish this?

I'm pretty sure I can take care of the second Pi by doing the initial setup over ethernet by directly connecting it to my router. The next step is unclear. After connecting the two, how can I get the first Pi to share it's wifi network connection over ethernet and use DHCP to assign an address on the same subnet to the second Pi?

User avatar
Davespice
Forum Moderator
Forum Moderator
Posts: 1665
Joined: Fri Oct 14, 2011 8:06 pm
Location: The Netherlands
Contact: Twitter

Re: Bridge wifi network connection to second Pi over etherne

Wed Apr 10, 2013 9:50 am

Here is how you can make the Pi a wifi access point;
http://sirlagz.net/2012/08/09/how-to-us ... er-part-1/

I know that is not exactly what you want but you can probably use parts of it for this.

On the headless Pi with the wifi link; set up the dnsmasq service as described in part 1 (but use interface=eth0) and then use the scripts he mentions in part 3, but just reverse eth0 to wlan0; like so

Code: Select all

iptables -F
iptables -X

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A OUTPUT -o eth0 -j ACCEPT

iptables -A POSTROUTING -t nat -o wlan0 -j MASQUERADE
iptables -A FORWARD -i eth0 -j ACCEPT
After that you should just be able to connect the two Pi's together via an ethernet cable.

Return to “Advanced users”