Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
do you using gnome/kde ? network manager have a master to make shared connection, if you like windows way... –  eicto Dec 16 '12 at 1:49
add comment

3 Answers

up vote 2 down vote accepted

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
share|improve this answer
add comment

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.

share|improve this answer
    
I've followed the steps to Enable NAT but i'm still having trouble. See edit. –  Josh Dec 15 '12 at 19:17
    
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 Dec 16 '12 at 1:18
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.