Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Elmir
New Contributor III

Using DNAT and SNAT simultaneously.

Hi Team,

 

I have a question about using DNAT and SNAT simultaneously.

 

For example, my global IP is 100.100.100.100/32. I want to enable RDP (port 3389) access to a local host with the IP address 192.168.10.10/32 from the Internet.
When a user connects to 100.100.100.100:42424, it should be forwarded to 192.168.10.10:3389 and also be SNATed to 192.168.20.10/32.

 

Is the configuration below workable?
------------------
config firewall vip
 edit "vip_192.168.10.10_Office-RDP"
  set service "TCP_42424"
  set extip 100.100.100.100
  set mappedip "192.168.10.10"
  set extintf "WAN_v2000"
  set portforward enable
  set mappedport 3389
 next
end

 

config firewall ippool
 edit "192.168.20.10/32_LAN-Office"
  set startip 192.168.20.10
  set endip 192.168.20.10
 next
end

 

config firewall policy

 edit 10
  set name "Internet->Office-RDP_allow"
  set srcintf "WAN_v2000"
  set dstintf "LAN_v2002"
  set action accept
  set srcaddr "Gr_AA" "Gr_BB" "Gr_CC"
  set dstaddr "vip_192.168.10.10_Office-RDP"
  set schedule "always"
  set service "TCP_42424"
  set nat enable
  set ippool enable
  set poolname "192.168.20.10/32_LAN-Office"
 next
end
------------------

2 Solutions
ozkanaltas
Valued Contributor III

Hello @Elmir ,

 

Yes, this configuration will work. But I have a suggestion about DNAT. If you use extport instead of service this will work properly. 

 

config firewall vip
 edit "vip_192.168.10.10_Office-RDP"
  set extip 100.100.100.100
  set mappedip "192.168.10.10"
  set extintf "WAN_v2000"
  set portforward enable
  set extport 42424
  set mappedport 3389
 next
end

 

If you have found a solution, please like and accept it to make it easily accessible to others.
NSE 4-5-6-7 OT Sec - ENT FW

View solution in original post

If you have found a solution, please like and accept it to make it easily accessible to others.NSE 4-5-6-7 OT Sec - ENT FW
Elmir
New Contributor III

I made some adjustments.

Initially, it wasn't functioning with the dynamic NAT pool, so I configured it as interface SNAT instead.
Additionally, in the firewall policy, RDP should be permitted rather than the external port ("TCP_42424").

To summarize, the final configuration will look as follows:
------------------
config firewall vip
  edit "vip_192.168.10.10_Office-RDP"
    set extip 100.100.100.100
    set mappedip "192.168.10.10"
    set extintf "WAN_v2000"
    set portforward enable

    set extport 42424
    set mappedport 3389
  next
end

 

config firewall policy
  edit 10
    set name "Internet->Office-RDP_allow"
    set srcintf "WAN_v2000"
    set dstintf "LAN_v2002"
    set action accept
    set srcaddr "Gr_AA" "Gr_BB" "Gr_CC"
    set dstaddr "vip_192.168.10.10_Office-RDP"
    set schedule "always"
    set service "RDP"
    set nat enable
  next
end
------------------

View solution in original post

3 REPLIES 3
ozkanaltas
Valued Contributor III

Hello @Elmir ,

 

Yes, this configuration will work. But I have a suggestion about DNAT. If you use extport instead of service this will work properly. 

 

config firewall vip
 edit "vip_192.168.10.10_Office-RDP"
  set extip 100.100.100.100
  set mappedip "192.168.10.10"
  set extintf "WAN_v2000"
  set portforward enable
  set extport 42424
  set mappedport 3389
 next
end

 

If you have found a solution, please like and accept it to make it easily accessible to others.
NSE 4-5-6-7 OT Sec - ENT FW
If you have found a solution, please like and accept it to make it easily accessible to others.NSE 4-5-6-7 OT Sec - ENT FW
Elmir
New Contributor III

Hi,

Thank you!)

Elmir
New Contributor III

I made some adjustments.

Initially, it wasn't functioning with the dynamic NAT pool, so I configured it as interface SNAT instead.
Additionally, in the firewall policy, RDP should be permitted rather than the external port ("TCP_42424").

To summarize, the final configuration will look as follows:
------------------
config firewall vip
  edit "vip_192.168.10.10_Office-RDP"
    set extip 100.100.100.100
    set mappedip "192.168.10.10"
    set extintf "WAN_v2000"
    set portforward enable

    set extport 42424
    set mappedport 3389
  next
end

 

config firewall policy
  edit 10
    set name "Internet->Office-RDP_allow"
    set srcintf "WAN_v2000"
    set dstintf "LAN_v2002"
    set action accept
    set srcaddr "Gr_AA" "Gr_BB" "Gr_CC"
    set dstaddr "vip_192.168.10.10_Office-RDP"
    set schedule "always"
    set service "RDP"
    set nat enable
  next
end
------------------

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors