Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I have a really strange set up here am hoping some expert could help mw with I am hoping to set up a Gateway for a set of private ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    1

    Question Really Strange Nat GW help?


    Hello,

    I have a really strange set up here am hoping some expert could help mw with

    I am hoping to set up a Gateway for a set of private subnets which I want to nat on to a set of public ip's, one public ip per network, all on one public interface.

    So here is my setup

    Public Interface -

    Eth0:- IP 192.168.0.2 - 192.168.0.6

    Private Subnets -

    Eth1:- IP 192.168.100.1
    Eth2:- IP 192.168.100.1
    Eth3:- IP 192.168.100.1
    Eth4:- IP 192.168.100.1
    Eth5:- IP 192.168.100.1

    Now this is the strange one I have one public interface which I want to have 5 ips on. I was hoping that for each of these ips, I could nat and tie and give its sole use to only one private subnet. So

    Eth1 would go out eth0 with 192.168.0.2
    Eth2 would go out eth0 with 192.168.0.3

    Now this is where it gets stranger, Each of the private subnets need to have the same ip address so machine can be moved between the subnets without seeing any ip gateway changed :S

    Is this possible to achive with ip tables? I was thinking of IP Aliasas on Eth0 but I heard they are not supported by iptables.....

    Any Help would be greatly appriciated!

    Cheers,

    James

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Sure,

    Code:
    iptables -A POSTROUTING -o eth0 -s <private address1> -j SNAT <public address1>
    iptables -A POSTROUTING -o eth0 -s <private address2> -j SNAT <public address2>
    iptables -A POSTROUTING -o eth0 -s <private address3> -j SNAT <public address3>
    And so on.

    You are still going to need to setup your sub-interfaces

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Linux Newbie framp's Avatar
    Join Date
    Jul 2006
    Location
    Stuttgart, Germany
    Posts
    240
    Quote Originally Posted by brownjl View Post
    Private Subnets -

    Eth1:- IP 192.168.100.1
    Eth2:- IP 192.168.100.1
    Eth3:- IP 192.168.100.1
    Eth4:- IP 192.168.100.1
    Eth5:- IP 192.168.100.1
    AFAIK every NIC has to have a different IP Address for a different Network. E.g.
    Code:
    Eth1:- IP 192.168.100.1
    Eth2:- IP 192.168.101.1
    Eth3:- IP 192.168.102.1
    Eth4:- IP 192.168.103.1
    will work. But your config will not work. Did I miss something?
    "Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." Linus Benedict Torvalds

Posting Permissions

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