LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   getting linux box to run as a switch and router btwn subnets (https://www.linuxquestions.org/questions/linux-networking-3/getting-linux-box-to-run-as-a-switch-and-router-btwn-subnets-608436/)

glok_twen 12-21-2007 05:27 PM

getting linux box to run as a switch and router btwn subnets
 
hi. i have a linux box with 2 nic's, one wireless and one wired. i have the wireless nic successfully linked to the wireless lan and can browse. i have the wired one connected to a switch and want to let other machines hardwired to that same switch route through the linux box that's wirelessly connected via the first nic to my router. can't get this to work.

right now from linux i can:
- browse externally
- ping the nic on another hardwired node connected to the switch

from the hardwired node i can:
- ping the hardwired nic on the linux box
- ping the wireless nic on the linux box
- BUT i can not ping from all the way through the linux machine to the router. nor can i get external.

can you tell what i mis-configured?

here is netstat -r. wlan0 connects wirelessly to my lan from linux. eth0 is the one hardwired to a switch and then connected to an xp box.

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
link-local * 255.255.0.0 U 0 0 0 wlan0
default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0

pentode 12-21-2007 05:53 PM

Check out bridging in Linux:

http://www.linux-foundation.org/en/Net:Bridge

Bridging is supported in Linux, but some wireless NIC drivers may not support it.

jschiwal 12-21-2007 06:43 PM

I once used my laptop to give my desktop wireless access. You are doing the same thing. The only difference is that I subnetted my network into 192.168.0.0 & 192.168.128.0 with a 255.255.128.0 netmask.

The other computers should use the Linux box's NIC IP address as the default gateway.
On the linux box you need to enable ip_forward
As root: echo 1 >/proc/sys/net/ipv4/ip_forward.

On some Linux systems, this is done in a startup script. On others, you can enable ip forwarding in the network setup program.
IIRC, I still needed to modprobe the ip_conntrack kernel module (or was it tcp_conntrack) for forwarding to work. On recent kernels it is called the nf_conntrack module. The description of the module is that it is used for masquerading, which I wasn't doing, but I still needed this module for forwarding to work.

I don't use ipv6 at all and don't know if something else needs to be done in that case.


All times are GMT -5. The time now is 01:52 AM.