# Using Gentoo box as a wireless bridge?

## Theophile

I have a Gentoo machine and an Xbox upstairs. The Gentoo machine has a wireless enternet card AND an integrated wired ethernet port. The wireless card connects to the wireless router and I get my internet connection through that. I'd like to set it up so I can plug the Xbox into the integrated wired ethernet port on the Gentoo box and get the Xbox on the internet like that.

I imagine this will require setting up a dhcp server on the Gentoo box and some messing with iptables but I am a complete newb in this regard. Any and all help appreciated!

----------

## eigenman

I think the following link explains what you should do: http://www.gentoo.org/doc/en/home-router-howto.xml

Eigenman

----------

## magic919

I'd consider bridging the wired and wireless interfaces.  Give the bridge the config of the current wireless regarding IP.  The XBOX will then acquire an IP from your wireless router.  See /etc/init.d/net.example regarding bridging.

----------

## Antimatter

 *magic919 wrote:*   

> I'd consider bridging the wired and wireless interfaces.  Give the bridge the config of the current wireless regarding IP.  The XBOX will then acquire an IP from your wireless router.  See /etc/init.d/net.example regarding bridging.

 

But I recall for a while bridging between wired and wireless interface doesn't work, so it may be needed to do something else.  I'm not sure, but maybe some form of NAT or something alikin to it to simulate how a bridge works...

----------

## magic919

There's nothing stopping wired and wireless interfaces being bridged.  A quick Google reveals this.  By the time the data reaches the kernel it doesn't matter what kind of network device was used.  Why simulate bridging when you can have real bridging?  It can handle bridging, provide STP - can't be bad.

----------

## Monkeh

DHCP and iptables are not required.

It's relatively simple, however I don't have my AP handy to give you the details. I did however use a wiki entry on gentoo-wiki.com.. this one. I didn't follow it exactly however.

You'll also need to sort out some sort of encryption. I used hostapd to do WPA on mine (Atheros chipset).

----------

## magic919

He's got wireless already.  He just wants to add wired for the Xbox.

----------

## Monkeh

 *magic919 wrote:*   

> He's got wireless already.  He just wants to add wired for the Xbox.

 

I WAS posting that at 5am. Anyway, that makes no difference to the bridge itself.

----------

## lbrtuk

 *magic919 wrote:*   

> There's nothing stopping wired and wireless interfaces being bridged.  A quick Google reveals this.  By the time the data reaches the kernel it doesn't matter what kind of network device was used.

 

Not quite true. http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.usage.html#bridge

However, this could be slightly out of date - there seem to ve several HOWTOs telling you to do this and they wouldn't be there if they didn't work to some extent. However, I'm pretty sure the (wifi) driver needs to support it. For instance, a basic wifi driver which lacks the functionality to send frames with a 'forged' MAC wouldn't be able to bridge because it would have to be able to forward frames from its clients who have different MACs.

I can't find anything definite on software 802.3/802.11 bridging in linux.

----------

## Monkeh

 *lbrtuk wrote:*   

>  *magic919 wrote:*   There's nothing stopping wired and wireless interfaces being bridged.  A quick Google reveals this.  By the time the data reaches the kernel it doesn't matter what kind of network device was used. 
> 
> Not quite true. http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.usage.html#bridge
> 
> However, this could be slightly out of date - there seem to ve several HOWTOs telling you to do this and they wouldn't be there if they didn't work to some extent. However, I'm pretty sure the (wifi) driver needs to support it. For instance, a basic wifi driver which lacks the functionality to send frames with a 'forged' MAC wouldn't be able to bridge because it would have to be able to forward frames from its clients who have different MACs.
> ...

 

It's exactly the same as bridging normal ethernet. You enable bridging support, install bridgeutils, and create a bridge with the wireless interface and the wired interface. That's it.

----------

## ronmon

You certainly can bridge wired and wireless network devices. My dual port gigabit card is br0 and a Phobos/tulip card plus the Prism card are br1. I don't know if you could still get an IP from the wireless router like that, though. The right way to do it would be to put netfilter/iptables in your kernel, preferably as modules. Then use a simple GUI tool, like Firestarter, to set up forwarding. dnsmasq could handle dns-caching and also has a built-in dhcp server. It's pretty easy to set up.

Because of the name, wireless AP bridging is often confused with kernel-supported network bridging, but it is a completely different animal. For that you'd probably need hostapd and a supported wireless chipset. From /etc/hostapd/hostapd.conf:

```

# Associate as a station to another AP while still acting as an AP on the same

# channel.

#assoc_ap_addr=00:12:34:56:78:9a

```

Of course, if your wireless router has wired ports and is suitably located you could just plug straight into that.

----------

## nobspangle

the whole point of bridging is that you can bridge anything with anything else.

----------

## Monkeh

ronmon, there's no need for dhcp, dns, or anything else. You just bridge the two networks, and anything connected on the wired NIC will, after a few seconds, have full access to the rest of the network.

----------

## ronmon

I believe you Monkeh, that's nice to know. Like I said, I had never done it that way.

----------

## lbrtuk

 *Monkeh wrote:*   

> It's exactly the same as bridging normal ethernet. You enable bridging support, install bridgeutils, and create a bridge with the wireless interface and the wired interface. That's it.

 

I'm going to have to check whether this works with the rt2500 drivers.

----------

## Monkeh

 *lbrtuk wrote:*   

>  *Monkeh wrote:*   It's exactly the same as bridging normal ethernet. You enable bridging support, install bridgeutils, and create a bridge with the wireless interface and the wired interface. That's it. 
> 
> I'm going to have to check whether this works with the rt2500 drivers.

 

It should. As far as I know, no specific support is required in the driver. It's easy enough to test.

----------

## Theophile

It's beginning to look like a true "bridge" is not the way I want to go.

The Gentoo machine in question is my media player/theater server and it needs to have access to the LAN as normal. Whenever I creat br0 and assign eth0 and wlan0 to it, I lose the ability to accecss any of the other machines on the network.

Also, once I do bridge the interfaces, the entire machine locks up soon after and has to be hard reset. I am thinking this may be due to the fact that I am using a Realtek 8185 card with "experimental" drivers (r8180).

Would the router set up howto be more what I am looking for?

----------

## guero61

 *Quote:*   

> 
> 
> The Gentoo machine in question is my media player/theater server and it needs to have access to the LAN as normal. Whenever I creat br0 and assign eth0 and wlan0 to it, I lose the ability to accecss any of the other machines on the network.
> 
> 

 

That's because eth0 and wlan0 become non-atomic parts of the bridge - if you still want to access the box hosting the bridge, assign an IP to the brX interface:

```

ifconfig br0 192.168.0.1

```

/etc/conf.d/net has hooks to handle this very nicely - I'm currently doing the same with 6 NICs.

----------

