Portforwarding on a zyxel device using the ZynOS cli

Due to a change of jobs, my xDSL connection was terminated today. Luckily I have other means of Inet access, but given that I run my own server I needed some portforwarding in order to be a happy camper.

Getting access to the router using telnet was easy.

telnet 10.0.0.1 23023

It was harder (hence this post) to figure out to do port forwarding. Basic stuff first. What version of ZynOS?

ras> sys version

 ZyNOS version: V3.40(AHX.4) | 05/02/2008
 romRasSize: 1407100
 system up time:   513:16:29 (b0380b6 ticks)
 bootbase version: V1.06 | 1/20/2006

Using help I figure out that I needed to go for the ip section

ras> help
Valid commands are:
sys             exit            ether           wan
ip              bridge          lan

But then I was lost

ras> ip
address         alias           aliasdis        arp
dhcp            dns             httpd           icmp
ifconfig        ping            route           smtp
status          udp             rip             tcp
telnet          tftp            traceroute      xparent
tredir          backup          mcastChan       igmp
policyrouting

Where was the portforward section?? I litteraly used an hour figuring out what to do. It turns out, that it is a leap of faith kind of thing:

ras> ip nat
hashTable       server          service         resetport
incikeport      session         addrmap         AOL-version9

Lo and behold, it is all there ;-) The rules are ordered in sets, where you edit a given rule in a set. When you get hold of the syntax it is actually quite easy

ras> ip nat server disp
Server Set: 1

Rule         name             Svr P Range    Server IP       LeasedTime
 Active  protocol     Int Svr P Range    Remote Host IP Range
--------------------------------------------------
 1 DMZ                       default             0.0.0.0   0
 No      ALL               0 - 0              0.0.0.0 - 0.0.0.0
 2 WWW                       80 - 80            10.0.0.5   0
 YES      ALL               0 - 0              0.0.0.0 - 0.0.0.0

Then you load a set, edit the rules and write the set. Eg

# Load set 1
ras> ip nat server load 1
#edit rule 2
ras> ip nat server edit 2 forwardip 10.0.0.5
# save set 1
ras> ip nat server save

All done.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.