routing wlan-usb to eth0 - Networking

This is a discussion on routing wlan-usb to eth0 - Networking ; 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| / ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: routing wlan-usb to eth0

  1. routing wlan-usb to eth0

    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




  2. Re: routing wlan-usb to eth0

    > 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

  3. Re: routing wlan-usb to eth0

    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


  4. Re: routing wlan-usb to eth0

    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.

  5. Re: routing wlan-usb to eth0

    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 to Thread