Stefan Monnier wrote:
>> sounds kind of embarassing, but I don't get the following working:
>
>> -----------
>> |linux-PC |
>> |192.168.1.20-eth--|192.168.1.1|
>> | | |router |---eth-----|Cablemodem|-internet
>> | | |-----------| DHCP ^
>> | | /should connect!
>> | |==usbwlan ............ wlam |--------| /
>> |---------| 192.168.4.22 192.168.4.23|notebook| /
>> |--------|
>
>> The notebook should connect to the internet via the linux-PC.
>
>> I set up both wlan-devices, on my linux-PC a ndiswrapper USB-Stick,
>> and on my notebook a PCMCIA-card. I can ping each other, ok.
>
>> What needs to be done on linux-PC, so that it routes the packets it
>> receives via the USB-Stick to ethernet and back?
>
>> I've already read the man page of route an tried many 'route add's,
>> but no success.
>
>> Do I need iptables for this?
>
>> Could someone post me a hint for a comprehensive routing tutorial?
>
> Check that /proc/sys/net/ipv4/ip_forward is not 0, and check your routes.
> That should be all,
And of course the laptop needs to know it can use PC as a gateway. On the
laptop do
route add default gw 192.168.4.22
You also have to let the router know that it should route packets from
192.168.4.0 through 192.168.1.20, if it's even possible depends on your
model. My router won't do it. If that's the case, use NAT on the PC.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
is the most basic way of doing it.
--
Lasse Jensen [fafler at g mail dot com]
Linux, the choice of a GNU generation.
|