Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Oct 2003 21:04:23 +0200
From:      Nils Vogels <nivo+sender+8eb026@yuckfou.org>
To:        freebsd-net@freebsd.org
Subject:   Reverse IP NAT to secondary IP address
Message-ID:  <3F9AC937.4070200@yuckfou.org>

next in thread | raw e-mail | index | archive | help
Hi there!

I'm trying to solve a situation that I have with a device which needs 
SNMP polling, but is not normally reachable to the outside world, 
because it cannot install a default gateway.

In short, a situation scetch:



                                                                         
            SNMP-server (192.168.2.2/24)
                                                                                         
-----------
+------------+                            +-------------+         
             |
|  WWW       |--------------------|   Gateway    | --------------+
+------------+                            
+-------------+                      |
    192.168.0.2/24         192.168.0.1        IP: 195.x.x.x.x           
\-----> Internet (0.0.0.0/0)
                                         (rl0)             Alias: 
192.168.2.1
                                                                         
(ed0)

Now what I am trying to do is get statistics from the SNMP-server into 
the WWW box, but I am stuck on the following:

WWW is a FreeBSD-4.8 box.
Gateway is a FreeBSD-4.8 box with IP Filter
Since the SNMP-server does not have a default route, the traffic needs 
to originate from an IP address within the same subnet as the Gateway.
To that end, I have added an alias IP of 192.168.2.1 to the gateway. 
When I run an snmpwalk from the gateway all goes fine.

Since the traffic is coming from WWW and heading through the Gateway, 
which does not bridge, I have to perform some form of NATting in the 
gateway.

I've been searching and attempting various redirects and map entries, 
and am now stuck at:

map rl0 from 192.168.0.0/24 to 192.168.2.0/24 port = 161 -> 192.168.2.1/32

I think I'm close .. can someone give me the final hint ? ;-)

Thanks,

Nils.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F9AC937.4070200>