How do I bridge connections in Debian?

3

In windows I can select Local Area Connection and Wireless Network Connection, right click and select Bridge Connections

How can I achieve the same effect in Linux? (Debian to be exact)

Pretty much I want Computer B to connect to Computer A via ethernet cable. Well Computer A is connected wirelessly. Allowing Computer B to get on the internet.

== UPDATE ==

I've enabled IP forwarding and used the following iptables command:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

I'm still unable to access the internet from Computer B though.

Josh

Posted 2012-12-15T17:26:56.060

Reputation: 678

do you using gnome/kde ? network manager have a master to make shared connection, if you like windows way... – zb' – 2012-12-16T01:49:40.457

Answers

2

Here is a list of commands that you need to type in:

on computer A

  1. iptables -t nat -F (this will flush iptables nat section, everything that was there before)
  2. sysctl net.ipv4.ip_forward=1 (this will enable ip forwarding)
  3. iptables -t nat -A POSTROUTING -s IP_ADDRES_COMP_B -j MASQUERADE (this will nat eveything that comes from computer b

on computer B

  1. check that default gateway of this computer is COMPUTER A.
  2. check DNS servers on computer A , (cat /etc/resolv.conf) and set same on computer B.
  3. in case of trubles with DNS servers on computer A, use 8.8.8.8 as primary and 8.8.4.4 as secondary

NauT

Posted 2012-12-15T17:26:56.060

Reputation: 325

0

Check out this ArchWiki article. You should just need the Enable NAT and Manually adding an ip sections, but if that doesn't work, then check out the rest.
Edited: Forgot a section.

bb010g

Posted 2012-12-15T17:26:56.060

Reputation: 543

I've followed the steps to Enable NAT but i'm still having trouble. See edit. – Josh – 2012-12-15T19:17:11.813

Check out the second section listed. Sorry. (If that doesn't work, just read the rest and check out some of the other links and relevant manpages.) – bb010g – 2012-12-16T01:18:43.600

0

From the debian wiki - Bridge Connections

First, you should install bridge-utils package. Rest of the article is pretty straightforward and explains much about how to set up working bridge connection to another device.

With the abovementioned iptables command you just routed Computer B to Computer A's wireless adapter. But Computer B cannot use that directly because it lacks the needed rules. It doesn't know where to go or what to do with it, so to speak.

sachiel6

Posted 2012-12-15T17:26:56.060

Reputation: 51