Vyatta – Hairpin NAT

Działający Hairpin NAT (przekierowanie portów działające z zewnątrz i z wewnątrz):

set nat destination rule 10 destination address $IP_ZEWN
set nat destination rule 10 destination port $PORT
set nat destination rule 10 inbound-interface any
set nat destination rule 10 protocol $PROTO
set nat destination rule 10 translation address $IP_DOCELOWE
set nat destination rule 10 translation port $PORT
set nat source rule 10 destination address $IP_DOCELOWE
set nat source rule 10 destination port $PORT
set nat source rule 10 outbound-interface $LAN_IF
set nat source rule 10 protocol tcp
set nat source rule 10 source address $LAN_NET
set nat source rule 10 translation address masquerade
  • $IP_ZEWN – zewnętrzny IP routera
  • $PORT – przekierowywany port
  • $PROTO – protokół (tcp/udp)
  • $IP_DOCELOWE – wewnętrzne IP w lanie
  • $LAN_IF – interfejs sieci LAN
  • $LAN_NET – podsieć LANu (np. 10.0.0.0/24)