Is it possible to setup a linux box to act as a hub/switch between two interfaces? I have an ubuntu box connected wirelessly on wlan0. I'd like to connect up another machine to the ubuntu boxes eth0 and have the other machine use that connect AND be on the same network as the ubuntu box. Is this possible?
Hello "unknown" Google-User,
what you want is to set up a bridge rather than a router, if you want to span the subnet over lan and wlan. This will make your two NICs to behave like a switch.
Under Debian/Ubuntu, install the
bridge-utils
package. Then create a Bridge and add NICs to it:brctl addbr br0
brctl addif br0 eth0 wlan0
HTH
Yes it is possible. What you describe is very simple:
Note that this will dissapear when you reboot the "router" box. If you want it to persist across reboots, then you will need to edit
/etc/sysctl.conf
and either add or edit the following line to look like thisEDIT: As usual, security comes later. Note that by doing this, any wardriver will be able to connect to your local network, bypassing all firewalls. To get it to firewall, also run (as root)
CHAIN-OF-YOUR-CHOICE
might be INPUT, if you have a good chain set up. What I'd do instead is to do:As the question specifically says that they machines need to be on the same network, then IP forwarding or NAT/PAT isn't going to help.
What I think you want is to bridge the two interfaces. Maybe this "Ethernet Bridge + netfilter howto" can help.
IBM has also a nice guide how to build wireless access points in Linux