Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On arch Linux, I would like to mainly have eth0 (connected to bridged router) share the connection recieved from wlan0, Ive read tutorials but I'm not command sabby as other users are and don't completely understand. I would appreciate some help! Ty!

share|improve this question
4  
please do not put '[solved]' in the question or title, accepting an answer is the correct way to show that a problem was solved. It changes the way the question is displayed on the main listing as well as putting the green check mark on the answer you have marked as correct. –  Zypher Sep 25 '10 at 0:14
    
I'd appreciate it if nobody messed with this page. If you have any problems, contact me. Thank you. –  dbdii407 Sep 25 '10 at 0:26
10  
serverfault.com/faq Specifically the heading "Other people can edit my stuff" –  Zypher Sep 25 '10 at 0:45
    
@Zypher The URL you link to no longer exists. Has the relevant paragraph moved elsewhere? –  kasperd Apr 15 at 13:04
1  
@kasperd serverfault.com/help/editing –  Zypher Apr 15 at 13:06

3 Answers 3

up vote 9 down vote accepted

UPDATE

It is not possible to bridge between wireless (client a.k.a. station mode) and wired intefaces

According to this thread: http://kerneltrap.org/mailarchive/linux-ath5k-devel/2010/3/21/6871733

Setup NAT

One should set up NAT instead:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Assigning an IP

Then you have to assign IP addresses to yourself:

ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up

Install dhcp daemon

Install a dhcp server and add the following text to its config file (in /etc/dhcpd.conf or something similar)

subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.100 10.0.0.120;
    option routers 10.0.0.1;
    option domain-name-servers the-ip-address-you-have-in-etc-resolv.conf;
}

Start dhcpd

Then start it /etc/init.d/dhcpd start

And that's it!

Only read below if you are interested in the non-working bridging setup


brctl addbr mybridge
brctl addif mybridge eth0
brctl addif mybridge wlan0

First you create a bridge interface I choose an arbitrary name mybridge then add intefaces to it.

You should request a new ip address (This is needed only if you want to get a valid IP for the bridging device itself):

dhclient -d mybridge
share|improve this answer
1  
You don't actually need an IP address for the bridge interface for the bridging to work. –  Massimo Jun 18 '10 at 10:25
3  
can't add wlan0 to bridge mybridge: Operation not supported –  dbdii407 Jun 18 '10 at 13:21
    
@Massimo: yes that is true. The valid IP is needed to acccess the net from the "bridging device". –  cstamas Jun 18 '10 at 17:27
    
I'm guessing that there's no way around the wlan0 issue? –  dbdii407 Jun 18 '10 at 17:45
1  
NAT is something completely different from bridging. Bridging is layer two, NAT is layer three, and IPv4-specific. I don't understand why this is an accepted answer. –  Hugo Oct 3 '14 at 8:38

To bridge wifi interface you may use iw tool to enable 4addr likewise:

# iw dev <wifiInterface> set 4addr on

ie:

# brctl addif <bridgename> <wifiInterface>
can't add <wifiInterface> to bridge <bridgename>: Operation not supported

# iw dev <wifiInterface> set 4addr on
# brctl addif <bridgename> <wifiInterface>

Now it should work. You can show bridges using:

# brctl show
share|improve this answer

Depends on how mean the AP is to you:

1) It might only want to see packets coming from you, with your known link layer address (and hence not of bridged packets) 2) It might actually be even smarter, and know which IP address should belong to which link layer address (cause it knows DHCP and inspects it)

If 1+2 are both true, you need indeed something like IP NAT, DHCP, ..

But if only 1) is the case, you can fake the link-layer address, and reverse map it onto the right one in the other direction as described here:

https://wiki.debian.org/BridgeNetworkConnections#Bridging_with_a_wireless_NIC

share|improve this answer
    
This is really messy. And it requires extra setup every time you add a new computer. –  Michael Hampton Apr 15 at 14:49

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.