Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, My network configuration: 1st pc. eth0 - local area (192.168.0.1) eth1 - internet iptables -t nat -A POSTROUTING -j MASQUERADE echo 1 > /proc/sys/net/ipv4/ip_forward 2nd pc. eth0 - 192.168.2.1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lithuania
    Posts
    7

    Network forwarding - both directions


    Hello,

    My network configuration:

    1st pc.
    eth0 - local area (192.168.0.1)
    eth1 - internet
    iptables -t nat -A POSTROUTING -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward

    2nd pc.
    eth0 - 192.168.2.1 \
    eth1 - 192.168.1.1 / sharing internet to local area network

    eth2 - 192.168.0.2 -> getting internet from 1st pc.
    iptables -t nat -A POSTROUTING -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward

    3rd pc.
    eth0 - 192.168.1.2 -> getting internet from 2nd pc.

    The problem is:
    from 3rd pc I can ping all ips in network, but from 1st pc I can ping only 192.168.0.2. I don't see even "192.168.1.1"

    Why I need that? I want to redirect xxx port from 1st pc to 3rd pc.

    Any ideas?

  2. #2
    Just Joined! LlNUX's Avatar
    Join Date
    Oct 2007
    Posts
    12
    >but from 1st pc I can ping only 192.168.0.2. I don't see even "192.168.1.1"
    > Any ideas?
    I assume that you have mask 255.255.255.0 :

    1PC: 192.168.0.1\24 network 192.168.0.0
    2PC: 192.168.2.1\24 network 192.168.2.0
    - 192.168.1.1\24 network 192.168.1.0

    My fist guess is that PC1 and PC2 are on different networks so can not sees each other.

    hope this helps

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lithuania
    Posts
    7
    Then why I see pc1 from pc3?

    It looks like:

    internet <- eth1-pc1-eth0 <-> eth2<-| pc2-eth1 <-> eth0-pc3
    pc3 see - pc2 all eths, pc1 all eths
    pc2 see - pc3 eth, pc1 all eths
    pc1 see - only pc2 eth2

  4. #4
    Just Joined!
    Join Date
    Sep 2007
    Posts
    4
    Quote Originally Posted by MKas View Post
    Hello,

    My network configuration:

    1st pc.
    eth0 - local area (192.168.0.1)
    eth1 - internet
    iptables -t nat -A POSTROUTING -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward

    The problem is:
    from 3rd pc I can ping all ips in network, but from 1st pc I can ping only 192.168.0.2. I don't see even "192.168.1.1"

    Why I need that? I want to redirect xxx port from 1st pc to 3rd pc.

    Any ideas?
    this will be a very long answer
    your pc1 having a default route 0/0 via eth1.
    any route will be forward to that interface.
    try add static route to 1.0/24 and 2.0/24 network via their respective interface.
    and modify your -t nat statements (both on pc1 and pc2) to include only nat-ed interface :
    ipt -t nat -I POSTROUTING -o <internet_intf> bla bla...

    why?
    so that your interfaces wont get nat-ed all of them.

    HTH.

Posting Permissions

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