Networking Forums

Networking Forums > Computer Networking > Linux Networking > setting up symmetric NAT

Reply
Thread Tools Display Modes

setting up symmetric NAT

 
 
asif.fayyaz@gmail.com
Guest
Posts: n/a

 
      01-18-2006, 01:05 PM
Hello everyone, i want to setup Symmetric NAT using IPTABLES as shown
below


-----------------
------------------------------------
-----------------------

192.168.0.2----------------------192.168.0.1|172.25.25.4------------------------172.25.25.0/255

-----------------
------------------------------------
-----------------------
ClientA PC with two network cards
Different PC's on LAN
on which NAT for client A
that can act as client B
is to be setup

can anyone tell me the commands that can setup NAT as above.

regards,

Asif

 
Reply With Quote
 
 
 
 
Eric Teuber
Guest
Posts: n/a

 
      01-19-2006, 08:24 PM
(E-Mail Removed) wrote:
> Hello everyone, i want to setup Symmetric NAT using IPTABLES as shown
> below
>
>
> -----------------
> ------------------------------------
> -----------------------
>
> 192.168.0.2----------------------192.168.0.1|172.25.25.4------------------------172.25.25.0/255
>
> -----------------
> ------------------------------------
> -----------------------
> ClientA PC with two network cards
> Different PC's on LAN
> on which NAT for client A
> that can act as client B
> is to be setup
>
> can anyone tell me the commands that can setup NAT as above.


honestly, i cannot see any schema behind the clutter above, please
remember we all have different mail clients and settings.

However, symmetric NAT is an interesting issue, do you have a real usecase?

Eric
 
Reply With Quote
 
Asif
Guest
Posts: n/a

 
      01-26-2006, 08:56 AM
Actually I am working on SIP application. SIP has the problem on NATes
networks. STUN is one of the solutions. I have embedded STUN client
functionality inside SIP application. Now i have to test the
application. There are four scenerios of NATed network:

The following chart shows combinations of NATs at each endpoint with
the current NAT type definitions in STUN. The combinations are
classified into 4 groups: Class I, II, III and IV.

+----------+-----+-----+-----+-----+-----+
|\ EP-R| | | | | |
| -------- |Open | F | P | PR | SYM |
|EP-S \| | | | | |
|----------+-----+-----+-----+-----+-----+
| Open | | | |
|----------+ | | |
| F | | |(III)|
|----------+( I )| ( II ) | |
| P | | | |
|----------+ | +-----+
| PR | | | |
|----------+ | +-----+ |
| SYM | | | (IV) |
+----------+-----------------+-----------+
Note:
EP-S: Sending endpoint.
EP-R: Receiving endpoint.
(In full-duplex, both EP-a and EP-b in Figure 3.1
will have both EP-S and EP-R)
Open: Open to public network (no NAT)
F : Full-cone NAT
R : Restricted-cone NAT
PR : Port restricted-cone NAT

For setting up a test environment, I decided to setup as below:

192.168.0.2
+----------+
| ClientA |
+----------+
|
|
| eth1 eth0
| 192.168.0.1 | 172.25.25.41
+-------------|-------------+
| NAT1 |
+-------------|-------------+
|
|
|
172.25.25.42 |
+---------------------------+
|Proxy\Registrar,STUN Server|
+---------------------------+
|
|
eth1 eth0 |
10.0.0.1 |172.25.25.43 |
+-------------|-------------+
| NAT2 |
+-------------|-------------+
|
|
|
| 10.0.0.2
+----------+
| ClientB |
+----------+

172.25.25.X ---- LAN (External Network for client A and B)
192.168.0.X ---- Private Network 1 (Internal Network for Client A)
10.0.0.X ---- Private Network 2 (Internal Network for Client B)

ClientA and ClientB are sip clients with STUN functionality embedded.

NAT1 and NAT2 are internal LAN NAT. I mean for testing purpose, i have
used two machines with two network cards.

below is the configuration of NAT1 using iptables. Also I am
configuring it for UDP protocol as SIP application is using UDP for
both signaling and media streaming.

> iptables -A PREROUTING -t nat -d 172.25.25.41 -i eth0 -j DNAT --to 192.168.0.2


This tells NAT1 to change the destination of the packet recieved on
eth0 to clientA address whenever the destination is eth0 (172.25.25.41)

> iptables -A FORWARD -d 192.168.0.2 -j ACCEPT
> iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT


For forwarding the packets from eth1 and to remember its state

> iptables -A POSTROUTING -t nat -p udp -s 192.168.0.2 -o eth0 -j SNAT --to 172.25.25.41:7070-7074


to change the source address of the packet to a pool of address
before routing to eth0. My intention was to make it symmetric.

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


to set the ip_forward table ON

The above commands I used for making NAT1 symmetric, For making it
port restricted, I change the POSTROUTING command above and make it
like this:
> iptables -A POSTROUTING -t nat -p udp -s 192.168.0.2 -o eth0 -j SNAT --to 172.25.25.41:8080


Here NAT1 will change the source address of ClientA packets to same
address for routing. I am using it for testing purpose so it will work
as long as only one client exists in Private Network 1.

For making NAT1 restricted, I change the above POSTROUTING command
and make it like this:

> iptables -A POSTROUTING -t nat -p udp -s 192.168.0.2 -o eth0 -j SNAT --to 172.25.25.41


For making it FULL CONE NAT, i have to think about it.

So what I want is a test environment for my SIP application. I can't
use application Gateway, as only NAT will work here because after
testing here, i will try to test it on some real environment. I wants
IPTABLE commands that can do the above task. Please suggest some thing
if you have some better option in your mind. Like If there is some
application that can setup NAT as mentioned above or if I can test my
application on some public STUN and proxy servers on the Internet.
ALso, if you think this can be performed by some utility on some
different OS like Windows, pleass suggest me.

regards,

Asif

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help setting this up... Olly Wireless Internet 0 10-17-2007 06:23 PM
Simple symmetric NAT Setup using IPTABLES Asif Linux Networking 2 01-23-2006 12:15 PM
BT central - symmetric or assymetric? Ian Stirling Broadband 1 01-19-2006 10:59 AM
Need help Setting up JENNY Wireless Networks 1 05-23-2005 08:52 PM
Symmetric NAT: What is it, and what can I do about it? Noam Nelke Network Routers 0 03-01-2005 06:08 AM



1 2 3 4 5 6 7 8 9 10 11