Vyatta Port Forwad port X to port Y

Scenario / Question:

How do I port forward port 2202 to port 22 on 192.168.0.1 server with Vyatta.

Solution / Answer:

Configure DNAT rules with port destination and firewall destination rules

NAT RULES

set service nat rule 600 type destination
set service nat rule 600 protocol tcp
set service nat rule 600 inside-address port 22
set service nat rule 600 inside-address address 192.168.0.1
set service nat rule 600 inbound-interface eth0
set service nat rule 600 destination port 2202
commit
save

Firewall Rules

set firewall name eth0in rule 600 action accept
set firewall name eth0in rule 600 protocol tcp
set firewall name eth0in rule 600 destination address 192.168.0.1
set firewall name eth0in rule 600 destination port 22
set firewall name eth0in rule 600 state new enable
set firewall name eth0in rule 600 state established enable
set firewall name eth0in rule 600 state related enable

set interfaces ethernet eth0 frewall in name eth0in  (if not already set, configure a name for "eth0 firewall in" to eth0in )

commit

save

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

2 Comments so far

  1. [...] Kernel Hardware Vyatta Port Forward [...]

  2. sychic on January 2nd, 2012

    I know this is rather an old post, but Im trying to acomplish just that atm. I want to be able to port forward on my vyatta router with NAT enabled, to be able to ssh to my CentOS within.

    I have the same config as described above, but it doesnt work for me, keeps saying “Connection refused” :(

    Any help/hints appreciated,

    best regards,

    sych

Leave a reply