• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

NAT source rewrite from External sources (WAN) to (LAN) interface IP address

Scheduled Pinned Locked Moved NAT
5 Posts 2 Posters 17.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    shon
    last edited by Feb 2, 2012, 9:16 PM Feb 1, 2012, 3:20 PM

    I'm trying to figure out how to rewrite the SRC IP of external clients hitting my internal Apache webserver to the LAN interface IP address of the firewall.

    1.   _______
                                                                          ||            ||
                                                                          ||||
                                                                         |
    __|
                                                         HTTP request to example.com = 4.4.4.4
                                                                 External IP of client: 5.5.5.5

    WAN IP
                 4.4.4.4
              _____________                                                                                                                                                             _____________                                    
              | pfsense 2.0.1   |               3.    Rewritten SRC IP request from the firewall                                                                       | Apache             |
              |                        |            β€“-------------------------------------------------------------------------                                                                   |        Web          |
              |                        |              src ip 192.168.1.1 dst IP 192.168.1.10 dst port 80 ->                                                                |    Server           |
              |                        |             ---------------------------------------------------------------------------                                                                  |                        |
              | ____________ |                                                                                                                                                            |   192.168.1.10  |
                  LAN IP                                                                                                                                                                       _____________
                192.168.1.1

    1. Packet requests comes in to 4.4.4.4 (WAN Port on pfsense) on port 80 from an External client of 5.5.5.5

    2. Rewrite External SRC IP 5.5.5.5 to the LAN IP Address of the firewall   which is 192.168.1.1

    3. Send that request to the Web Server of 192.168.1.10  with the SRC IP of 192.168.1.1 instead of coming from 5.5.5.5

    Thanks!

    1 Reply Last reply Reply Quote 0
    • S
      shon
      last edited by Feb 2, 2012, 3:03 PM

      This looks like the iptables command (Reverse NAT) that I would use, but I don't know how to do that in the GUI of pfsense.

      iptables -t nat -A PREROUTING -i eth1 -j DNAT -d 4.4.4.4 –to 192.168.1.1

      1 Reply Last reply Reply Quote 0
      • J
        jimp Rebel Alliance Developer Netgate
        last edited by Feb 7, 2012, 1:51 PM

        • Switch to manual outbound NAT (Firewall > NAT, outbound tab)
        • Add a rule for the LAN interface, source of ANY, destination of 192.168.1.10, translation = Interface address.

        Remember: Upvote with the πŸ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • S
          shon
          last edited by Mar 6, 2012, 7:34 PM

          That worked like a charm!

          Thanks!

          1 Reply Last reply Reply Quote 0
          • S
            shon
            last edited by Mar 13, 2012, 9:06 PM

            @shon:

            I was able to accomplish this but without having to select the "Manual Outbound NAT rule generation".  The rule was good enough to do the job.

            Thanks!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received