Networking Forums

Networking Forums > Computer Networking > Linux Networking > routing wlan-usb to eth0

Reply
Thread Tools Display Modes

routing wlan-usb to eth0

 
 
Martin Klar
Guest
Posts: n/a

 
      02-10-2007, 10:58 PM
Hi folks,

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?


Thank anyone for any ideas,

Martin



 
Reply With Quote
 
 
 
 
Stefan Monnier
Guest
Posts: n/a

 
      02-11-2007, 12:39 AM
> 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,


Stefan
 
Reply With Quote
 
Martin Klar
Guest
Posts: n/a

 
      02-11-2007, 06:54 AM
Stefan Monnier wrote:

> Check that /proc/sys/net/ipv4/ip_forward is not 0, and check your routes.
> That should be all,


It is set to 1, I already checked it. That didn't get things working.

Martin

 
Reply With Quote
 
Lasse Jensen
Guest
Posts: n/a

 
      02-11-2007, 07:52 AM
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.
 
Reply With Quote
 
Martin Klar
Guest
Posts: n/a

 
      02-11-2007, 12:13 PM
Lasse Jensen schrieb:
> Stefan Monnier wrote:
>
>> 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.
>


Thank you very much, you hit the point. In fact, I had to add a route
and an iptables-chain on my router.

Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable local routing between eth0 and eth1 - iptables astonishs@yahoo.com Linux Networking 9 05-28-2008 02:34 AM
Can't get eth0 up (wired) - e1000 device eth0 does not seem to be present, delaying initialization. OtisUsenet Linux Networking 2 06-06-2007 02:57 AM
Routing everything through eth0 Phoenix Linux Networking 1 02-08-2007 01:40 PM
Need help w/routing between Eth0 and modem Scott Ehrlich Linux Networking 2 05-22-2005 11:19 AM
how tho change source address of eth0/eth0:1 ? news Linux Networking 2 06-09-2004 03:25 PM



1 2 3 4 5 6 7 8 9 10 11