OPNsense Forum

English Forums => Virtual private networks => Topic started by: skydiablo on June 28, 2022, 03:29:37 PM

Title: [SOLVED] Outbound NAT to IPSEC tunnel
Post by: skydiablo on June 28, 2022, 03:29:37 PM
Hi! i have an dummy network, an loopback interface with assigned IP (192.168.200.1/24). also an running IPSEC tunnel (non routed, non VTI). so i want my local LAN to NAT over this dummy network, so that any request from my local LAN is NATed by 192.168.200.1:



                                      ┌────────────────────────┐
                                      │                        │
┌───────────────────┐                 │ ┌────────────────────┐ │
│                   │                 │ │                    │ │
│  Remote Network   │   IP-SEC-Tunnel │ │  Dummy Network     │ │
│  10.22.248.0/21  ─◄─────────────────►─┼─ 192.168.200.0/24  │ │
│                   │                 │ │                    │ │
└───────────────────┘                 │ └─────────▲──────────┘ │
                                      │           │            │
                                      │           │            │
                                      │  ┌────────┴─────────┐  │
                                      │  │                  │  │
                                      │  │  Outbound NAT    │  │
                                      │  │                  │  │
                                      │  │   10.50.0.0/24   │  │
                                      │  │        │         │  │
                                      │  │        ▼         │  │
                                      │  │  192.168.200.1   │  │
                                      │  │                  │  │
                                      │  └────────▲─────────┘  │
                                      │           │            │
                                      └───────────┼────────────┘
                                                  │10.50.0.2
                                                  │
                                                  │
  ┌───────────┐                       ┌───────────┴───────────┐
  │           │                       │                       │
  │  Machine  │                       │  Local LAN            │
  │           │10.50.0.107            │  10.50.0.0/24         │
  │           ├──────────────────────►│                       │
  └───────────┘                       │                       │
                                      └───────────────────────┘


i have just add an outbound NAT, and try to ping from an machine like 10.50.0.107 to 10.22.250.1 ... the machine knows the right route (10.22.248.0/21 via 10.50.0.2 dev eth0) but no success. there is no NAT ing and no packet is arriving the IPSEC remote network.
is it possible like this to NAT the traffic to an IPSEC tunnel?
Title: Re: Outbound NAT to IPSEC tunnel
Post by: skydiablo on June 29, 2022, 03:49:11 PM
okay, i have solved by my own with this post by reddit: https://www.reddit.com/r/OPNsenseFirewall/comments/hrdzti/nat_not_working_with_ipsec_vpn/

thx for attention.
Title: Re: [SOLVED] Outbound NAT to IPSEC tunnel
Post by: Tech34 on July 17, 2024, 11:50:37 AM
Hello , i read your post on reddit, i was wondering if you could help me find a solution to my problem , i have the same issue , i've added the SPD entries and everything , the one to one NAT is correctly configured , the only difference that i have is that my WAN network isn't what i put inside the VPN tunnel in phase 2 , i have two virtual networks that needs to communicate in phase 2 ( 10.100.100.0/24 <--------IPSEC--------> 10.200.200.0/24 ), i don't know what i'm doing wrong , but if you have any idea , please share it !!