Find the answer to your Linux question:
Results 1 to 2 of 2
Here's my problem: I have 5 static IP's from my ISP, they are however in two different series. They look like this: 111.236.113.145 111.236.113.146 111.236.113.147 111.237.38.163 111.237.38.164 These also have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2004
    Posts
    1

    iptables, multiple interfaces


    Here's my problem:
    I have 5 static IP's from my ISP, they are however in two different series. They look like this:

    111.236.113.145
    111.236.113.146
    111.236.113.147
    111.237.38.163
    111.237.38.164

    These also have different GW's. 111.236.113.1 and 111.237.38.1.

    What I want to do is to add all these IP's to a linuxbox that act like a router/gateway and send those IP's through to a local ip (192.168.100.x). Four IPs should be passed on, the last one should be the machines own, which is also used for the general internetsharing.

    111.236.113.145 -> 192.168.100.10 Machine1
    111.236.113.146 -> 192.168.100.11 Machine2
    111.236.113.147 -> 192.168.100.12 Machine3
    111.237.38.163 -> 192.168.100.13 Machine4
    111.237.38.164 -> 192.168.100.* Machine5+

    So, I want all internet trafic that commes to/from Machine1 to go in and out through the given ISP-IP. Machine2 through that given one etc etc. Machine5 (server) shares it's IP with the rest of the computers that doesn't have an external IP of their own, some regular nat solution there.

    Righ now, the machine only have one NIC, but I will add another one when I know how to do this routing.

    Can someone give me a hand here? I've thought about using iptables for it, perhaps there's some other solution that you know of, please tell me anything you can about this.

    Edit:
    There is another NIC in the machine now.

  2. #2
    Linux Newbie
    Join Date
    Apr 2004
    Posts
    158
    Hi,

    Well there is no real problem here...

    Just use iptables to masquerade the addresses that come from the outside (and goes back out...);

    iptables -t nat -A POSTROUTING -j MASQUERADE

    You must also make sure that you have routing switch on

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

    That should be it...

    Then to disable/enable stuff that passes your router-box you edit the FORWARD chain...

    Look at www.netfilter.org for some more documentation...

    Regards

    Jonas

Posting Permissions

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