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.

I have a raspberry pi that I have put wifi on. I am also using its ethernet connection to bring internet to my XBox 360. I want to bridge these connections AND keep them both on the same network.

For example, my wlan0 is on 192.168.1.124. I want to place eth0 on some arbitrary ip within the 192.168.1.1 network (192.168.1.125 for example). I want to do this so that my XBox 360 can see other computers on the network so I can stream video to it. A solution where my 360 is on a different network (192.168.2.1 for example) will not allow me to access my network computers.

Any suggestions on how to do this?

EDIT: bridge_utils was giving me problems with dropping every 10-15 min. Only way to fix issue was a restart. I would rather use an iptables solution than a bridge_utils for this reason.

EDIT 2: interfaces file:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.124
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.1
wirless-power off

auto br0
iface br0 inet dhcp
bridge_ports wlan0 eth0

This bridges connection for about 15-20 min then fails. At this point, I have to restart RaspPi and XBOX to get internet working again.

share|improve this question

migrated from serverfault.com Feb 27 '13 at 20:43

This question came from our site for professional system and network administrators.

    
What you are trying to do is an "ethernet bridge", however and AFAIK iptables work at the IP layer or above. So I doubt you could have a proper ethernet bridge with iptables. So perhaps you could try to ask another question: how can I fix my bridge on Raspberry Pi to stop droping periodically? For this we would need information on how you configured it, which Distrib do you use, etc. –  Huygens Feb 27 '13 at 7:47
    
I'm not sure if I am trying to bridge. I want my XBox to have its own IP address assigned from the router and I want my Raspberry Pi to have it's own IP address assigned from router. I do not want my XBox and RaspPi to share a single IP address as it causes XBL NAT issues. –  moesef Feb 27 '13 at 8:00
    
what is connected to eth0 - the rest of your internal network? If so, then yes, you want to bridge eth0 and wlan0 but in this case you should leave eth0 and wlan0 unconfigured and only configure an ip address for your resulting bridging interface - br0 (which would probably be DHCP-configured then just as your eth0 interface was before you added the Wifi config) –  syneticon-dj Feb 27 '13 at 9:09
    
are you saying make eth0 and wlan0 inet manual and set br0 to inet dhcp? –  moesef Feb 27 '13 at 9:13
add comment

1 Answer

Ethernet bridging

What you are describing is basically that your RaspPi should be transparent for the network that connect your XBox to your router. Which means that when your XBox request an IP address (it does not have one yet) it will broadcast a message on the network which should reach the router. This bridging between the physical link between your raspPi and XBox to the other link between your RaspPi and router, should be done at ethernet level. So you describes an ethernet bridge, and the bridge utils should be the way to go. Perhaps you could give us more information to spot why your bridge is regularly dropping the connection.

here is an how to do Ethernet bridging on Linux and here is another article on Linux as an Ethernet Bridge.

Configuration

This configuration bridge the Wireless LAN (connected to your internet router) to your XBox. On your RaspPi:

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto eth0
allow-hotplug wlan0
auto br0


# The internet network interface
iface eth0 inet static
  address 192.168.2.1
  netmask 255.255.255.0


# The wireless side of the bridge
iface wlan0 inet manual
  wireless-essid MY_ESSID
  wireless-key **********
  wireless-mode master

# The local network bridge
iface br0 inet dhcp
  bridge_ports wlan0 eth0

And on your XBox set the IP address to be manual and 192.168.2.2/255.255.255.0 with the default gateway 192.168.2.1.

More advanced configuration and information here: Bridging with a wireless NIC

IP routing/gateway

At IP level, this is called routing. This technique however is meant to inter-connect to IP networks together, implying that they are not in the same address space. This can be done at iptables level using IP masquerading (aka NAT), and from your question this is not the way you want to go.

This implies that the IP subnet which belongs to your internet router network would be different than the one from your RaspPI/XBox link. You could try to fix an IP that belong from the internet router subnet by manually setting the IP address, and then you would need to set a static route on your internet router so that it is using your RaspPI to reach your XBox. But you need to be able to add those configuration on the internet router and XBox.

You can find a few articles:

share|improve this answer
    
see my second edit to see how i setup my Ethernet bridge. this way caused me to drop internet connection to both my Pi and my XBOX every 15-20 min –  moesef Feb 27 '13 at 8:53
    
I have updated my answer –  Huygens Feb 27 '13 at 9:28
    
this also doesn't work. My network is on 192.168.1.1. This would assign my XBox an IP on the 192.168.2.1 network. Also, I have no internet connectivity using this method, only network through wlan. –  moesef Feb 28 '13 at 6:46
    
@moesef There might be a few things forbidding (for security) the bridge to work, check the link I have in my post regarding Ethernet bridging, especially the section 7.7, 7.8, 7.15 and 7.16. Also I think I made a few mistakes in my answer. If none of the mentionned section solve the issue, try setting the XBox on the same subnet as the internet router and RaspPi, and set its gateway to your internet router IP. My familiarity with Ethernet bridges is "scholar", and that is a long time ago I was at university ;-) so I could state a few things wrong... I am waiting for your feedback then! –  Huygens Mar 1 '13 at 7:33
    
@moesef I have added another link for Ethernet bridging which might help you out better. –  Huygens Mar 1 '13 at 21:52
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.