LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2005, 06:42 AM   #1
okmyx
Member
 
Registered: May 2004
Location: Cornwall, UK
Distribution: Ubuntu 8.04
Posts: 464

Rep: Reputation: 31
Multi-NAT setup


Any one have any info,links,etc on setting up a 'Many to Many No Overload' Multi-NAT router.

I have two networks that i wish to bridge with a NAT router, i want some PC to have access to services on the other network but they need specific IP addresses.

e.g.
172.16.46.1 <-> 200.0.0.1 (don't ask why it's a 200 range it a long story)
172.16.46.2 <-> 200.0.0.2
172.16.46.3 <-> 200.0.0.3
172.16.46.4 <-> 200.0.0.4
etc....

I far as my understanding goes it will require 2 network cards with multiple IP on each and then some clever IPtables rules to do the translation.

Last edited by okmyx; 12-07-2005 at 07:54 AM.
 
Old 12-07-2005, 07:54 AM   #2
okmyx
Member
 
Registered: May 2004
Location: Cornwall, UK
Distribution: Ubuntu 8.04
Posts: 464

Original Poster
Rep: Reputation: 31
Done some more research and found out the this is also called one-to-one Nat (multi-nat is a netgear name).

So it should be possible to do using just iptables rules. Any ideas?
 
Old 12-07-2005, 01:28 PM   #3
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
hi...

you're right, for a single host (with eth0 your interface to internet), it goes like this:
Code:
iptables -t nat -A PREROUTING -i eth0 -d 200.0.0.1 -j DNAT --to-destination 172.16.46.1
iptables -t nat -A POSTROUTING -o eth0 -s 172.16.46.1 -j SNAT --to-source 200.0.0.1
ip addr add 200.0.0.1 dev eth0
Note that i precised the interface on the 2 iptables rules to avoid that traffic from 172.16.46.1 to the gateway itself (like if you ping your gateway as an exemple) be nated as well.

First line do the translation on the way from internet to LAN
Second line do it the other way around
Third line creates an alias on eth0 so that your gateway answers to arp queries and accept ip traffic to this IP as well as to its own.
 
Old 12-09-2005, 09:30 AM   #4
okmyx
Member
 
Registered: May 2004
Location: Cornwall, UK
Distribution: Ubuntu 8.04
Posts: 464

Original Poster
Rep: Reputation: 31
Excellent...thank you for your help.

With a little tweaking (coz im using two network cards) i have got this working perfectly.

After managing to pull this off I can no longer class myself as a newbie, but still a long way from guru.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NAT/Gateway setup cflyguy Linux - Networking 3 08-11-2005 11:47 PM
multi-monitor setup question bnordin Linux - Hardware 0 07-19-2004 01:07 AM
Multi monitor setup on Laptop bachmand Linux - Laptop and Netbook 0 02-10-2004 04:27 PM
setup multi domains email in postfix importboy03 Linux - Software 1 04-29-2003 04:06 PM
Proxy Client, Nat or other internet setup microchip21 Linux - Networking 4 02-10-2002 04:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration