Find the answer to your Linux question:
Results 1 to 3 of 3
I have come across a tough problem. I have 3 linux computers. I will refer to them as PC1, PC2 and PC3. PC1 and PC2 connect to each other with ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    1

    Connection Sharing


    I have come across a tough problem. I have 3 linux computers. I will refer to them as PC1, PC2 and PC3. PC1 and PC2 connect to each other with serial radios over a few miles. I use ppp to connect them. PC1 is the "dial in" system and has an ip address of 192.168.1.1. PC2 is assigned an IP of 192.168.1.200. The connection works great. Now PC3 connects to PC1 via a wireless card. The application I am doing this for requires that PC3 and PC1 be connected via 80211. The connection between PC1 and PC3 works perfect. PC3 has an ip address of 192.168.1.3. Now I can ping PC1 from PC3 and PC1 can ping PC2, but I cannot ping PC2 from PC3. I know that I cannot bridge wlan and ppp because of network layers 2 and 3, so I tried to use iptables to route the packets. I put in the following commands on PC1:



    iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE



    iptables -A FORWARD -i ath0 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT



    iptables -A FORWARD -i ppp0 -o ath0 -j ACCEPT



    echo "1" > /proc/sys/net/ipv4/ip_forward



    But I still cant ping PC2 from PC3. Can anyone point me in the right direction? I have been googleing for 2 days with no luck. Thanks in advance for any help.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,879
    I'll start by telling you I'm no expert at this (in fact I usually steer well clear of ip tables).

    My understanding of the IP stack implementation, however, is that it shouldn't matter what the underlying hardware is - that's the whole point of using the OSI 7-layer model for networks. Provided you have known IP addresses, you should be able to establish routes based on that.

    What I think you have to do is repeat your configuration statments, but use IP addresses rather than device names wherever you can.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Roxoff
    No need to steer clear of iptables. It isn't that hard once you have the basics.


    f15radar
    First off IPTABLES does no routing! It just allows/blocks traffic at the interface.
    This is how I see you setup now, please correct anything that is wrong.

    Device Int IP
    ------ ---- ----------------
    PC1 ath0 192.168.1.1
    PC1 ppp0 ?

    PC2 ppp0 192.168.1.200

    PC3 ath0 192.168.1.3

    If you are looking to just pass traffic from PC3 to PC2 and PC2 to PC3 your really don't need iptables. As stated above it does not route. By turning on forwarding, as you did, traffic should pass. If you have no reason for a firewall I would suggest you turn it off.

    Now to the problem at hand. Looking at the above there is an IP address missing from PC1 on the pp0 interface. Every interface needs an ip address for routing.

    On each machine can you provide the output from the following commands:

    Code:
    ifconfig
    route -na
    It looks to be a simple routing issue that can be fixed but I need to know the setup from the above to ensure what I tell you will work.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •