ScreenOS Firewalls (NOT SRX)
Showing results for 
Search instead for 
Do you mean 
Reply
Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos
Accepted Solution

NATed Interface from manual example not working on SSG5w

I recently got an SSG5w, and have been spending the last few weeks reading the manual and fiddling with the config.  I have a rather complex setup currently with an old Astaro firewall with lots of interfaces and vLANs and separate PPPoE, VoIP, and IPv6 firewalls that will all be replaced with the SSG5.  So I have already had to reinit the box as I could not delete all the cruft I first entered and started nice and clean.  Set up my zones, a few interfaces, and a policy then tried to get NAT working, to no success.  Below is my config file.  Interface 0/1 is the untrusted, public interface.  Interfaces 0/4.2 and 0/6 are the NATed interfaces I am trying to get working right now.

 

I am reading the most current manual (downloaded 7/31/09), Vol 2 - Interface Modes, NAT Modes, Configuring NAT mode.

 

set clock ntp
set clock timezone -5
set clock dst recurring start-weekday 2 0 3 02:00 end-weekday 1 0 11 02:00
set vrouter trust-vr sharable
set vrouter "untrust-vr"
exit
set vrouter "trust-vr"
unset auto-route-export
exit
set service "HP-Printing" protocol tcp src-port 1024-65535 dst-port 9100-9102
set service "IAX2" protocol tcp src-port 1024-65535 dst-port 5036-5036
set service "IAX2" + udp src-port 1-65535 dst-port 5036-5036
set service "MySSH" protocol tcp src-port 1-65535 dst-port 613-613
set service "MyVNC" protocol tcp src-port 1024-65535 dst-port 5901-5909
set service "MyVNC" + tcp src-port 1-65535 dst-port 5500-5500
set service "RSYNC" protocol tcp src-port 1024-65535 dst-port 873-873
set service "SIP-More" protocol tcp src-port 0-65535 dst-port 5061-5082
set service "SIP-More" + udp src-port 0-65535 dst-port 5061-5082
set service "Special1" protocol tcp src-port 1024-65535 dst-port 724-724
set service "Teredo" protocol tcp src-port 1024-65535 dst-port 3544-3545
set service "Webmin" protocol tcp src-port 1024-65535 dst-port 10000-10000
set service "Webmin" + tcp src-port 1024-65535 dst-port 20000-20000
set auth-server "Local" id 0
set auth-server "Local" server-name "Local"
set auth default auth server "Local"
set auth radius accounting port 1646
set admin name xxxxxxxxxxxxxx
set admin password xxxxxxxxxxxx
set admin ssh port nnnn

set admin auth timeout 30
set admin auth server "Local"
set admin format dos
set zone "Trust" vrouter "trust-vr"
set zone "Untrust" vrouter "trust-vr"
set zone "DMZ" vrouter "trust-vr"
set zone "VLAN" vrouter "trust-vr"
set zone id 100 "Home"
set zone id 101 "HTT"
set zone id 102 "Labs"
set zone id 103 "Office"
set zone id 104 "VoIP"
set zone "Untrust-Tun" vrouter "trust-vr"
set zone "Trust" tcp-rst
set zone "Untrust" block
unset zone "Untrust" tcp-rst
set zone "DMZ" tcp-rst
set zone "VLAN" block
unset zone "VLAN" tcp-rst
set zone "Home" block
unset zone "Home" tcp-rst
set zone "HTT" block
unset zone "HTT" tcp-rst
set zone "Labs" block
unset zone "Labs" tcp-rst
set zone "Office" block
unset zone "Office" tcp-rst
set zone "VoIP" block
unset zone "VoIP" tcp-rst
set zone "Untrust" screen tear-drop
set zone "Untrust" screen syn-flood
set zone "Untrust" screen ping-death
set zone "Untrust" screen ip-filter-src
set zone "Untrust" screen land
set zone "V1-Untrust" screen tear-drop
set zone "V1-Untrust" screen syn-flood
set zone "V1-Untrust" screen ping-death
set zone "V1-Untrust" screen ip-filter-src
set zone "V1-Untrust" screen land
set interface "ethernet0/0" zone "Untrust"
set interface "ethernet0/1" zone "DMZ"
set interface "ethernet0/3" zone "Office"
set interface "ethernet0/4" zone "Labs"
set interface "ethernet0/4.2" tag 17 zone "Labs"
set interface "wireless0/0" zone "Trust"
set interface "bgroup0" zone "Trust"
set interface bgroup0 port ethernet0/6
unset interface vlan1 ip
set interface ethernet0/0 ip 208.83.67.128/29
set interface ethernet0/0 route
set interface ethernet0/3 ip 208.83.67.152/29
set interface ethernet0/3 route
set interface ethernet0/4 ip 208.83.67.176/28
set interface ethernet0/4 route
set interface ethernet0/4.2 ip 192.168.128.16/28
set interface ethernet0/4.2 nat
set interface wireless0/0 ip 192.168.2.1/24
set interface wireless0/0 nat
set interface bgroup0 ip 192.168.1.1/24
set interface bgroup0 nat
set interface ethernet0/0 bandwidth egress mbw 1024 ingress mbw 1024
set interface ethernet0/3 bandwidth egress mbw 1024 ingress mbw 1924
set interface ethernet0/4 bandwidth egress mbw 1024 ingress mbw 1024
set interface ethernet0/4.2 bandwidth egress gbw 10 mbw 1024 ingress mbw 1024
unset interface vlan1 bypass-others-ipsec
unset interface vlan1 bypass-non-ip
set interface ethernet0/0 manage-ip 208.83.67.134
set interface ethernet0/3 manage-ip 208.83.67.156
set interface ethernet0/4 manage-ip 208.83.67.188
set interface ethernet0/4.2 manage-ip 192.168.128.18
unset interface ethernet0/0 ip manageable
set interface ethernet0/3 ip manageable
set interface ethernet0/4 ip manageable
set interface ethernet0/4.2 ip manageable
set interface wireless0/0 ip manageable
set interface bgroup0 ip manageable
set interface ethernet0/0 manage ping
set interface ethernet0/3 manage ping
set interface ethernet0/3 manage web
set interface ethernet0/4 manage ping
set interface ethernet0/4 manage web
set interface ethernet0/4.2 manage ping
set interface ethernet0/4.2 manage web
set interface ethernet0/4 dhcp server service
set interface ethernet0/4.2 dhcp server service
set interface wireless0/0 dhcp server service
set interface bgroup0 dhcp server service
set interface ethernet0/4 dhcp server enable
set interface ethernet0/4.2 dhcp server enable
set interface wireless0/0 dhcp server auto
set interface bgroup0 dhcp server auto
set interface ethernet0/4 dhcp server option lease 1440000
set interface ethernet0/4 dhcp server option gateway 208.83.67.188
set interface ethernet0/4 dhcp server option netmask 255.255.255.240
set interface ethernet0/4 dhcp server option dns1 208.83.67.148
set interface ethernet0/4 dhcp server option wins1 208.83.67.146
set interface ethernet0/4.2 dhcp server option lease 1440000
set interface ethernet0/4.2 dhcp server option gateway 192.168.128.18
set interface ethernet0/4.2 dhcp server option netmask 255.255.255.240
set interface ethernet0/4.2 dhcp server option dns1 208.83.67.148
set interface ethernet0/4.2 dhcp server option wins1 208.83.67.146
set interface wireless0/0 dhcp server option gateway 192.168.2.1
set interface wireless0/0 dhcp server option netmask 255.255.255.0
set interface bgroup0 dhcp server option gateway 192.168.1.1
set interface bgroup0 dhcp server option netmask 255.255.255.0
set interface ethernet0/4 dhcp server ip 208.83.67.185 to 208.83.67.187
set interface ethernet0/4.2 dhcp server ip 192.168.128.28 to 192.168.128.30
set interface wireless0/0 dhcp server ip 192.168.2.36 to 192.168.2.38
set interface bgroup0 dhcp server ip 192.168.1.33 to 192.168.1.35
unset interface ethernet0/4 dhcp server config next-server-ip
unset interface ethernet0/4 dhcp server config updatable
unset interface ethernet0/4.2 dhcp server config next-server-ip
unset interface ethernet0/4.2 dhcp server config updatable
unset interface wireless0/0 dhcp server config next-server-ip
unset interface bgroup0 dhcp server config next-server-ip
set interface "serial0/0" modem settings "USR" init "AT&F"
set interface "serial0/0" modem settings "USR" active
set interface "serial0/0" modem speed 115200
set interface "serial0/0" modem retry 3
set interface "serial0/0" modem interval 10
set interface "serial0/0" modem idle-time 10
set flow tcp-mss
unset flow no-tcp-seq-check
set flow tcp-syn-check
unset flow tcp-syn-bit-check
set flow reverse-route clear-text prefer
set flow reverse-route tunnel always
set domain htt-consult.com
set hostname newblock
set pki authority default scep mode "auto"
set pki x509 default cert-path partial
set dns host dns1 208.83.64.5
set dns host dns2 208.83.64.6
set dns host dns3 0.0.0.0
set ike respond-bad-spi 1
unset ike ikeid-enumeration
unset ike dos-protection
unset ipsec access-session enable
set ipsec access-session maximum 5000
set ipsec access-session upper-threshold 0
set ipsec access-session lower-threshold 0
set ipsec access-session dead-p2-sa-timeout 0
unset ipsec access-session log-error
unset ipsec access-session info-exch-connected
unset ipsec access-session use-error-log
set vrouter "untrust-vr"
exit
set vrouter "trust-vr"
exit
set url protocol websense
exit
set policy id 1 from "Trust" to "Untrust"  "Any" "Any" "ANY" permit
set policy id 1 disable
set policy id 1
exit
set policy id 3 name "Services" from "Labs" to "Untrust"  "Any" "Any" "ANY" permit
set policy id 3
exit
set policy id 2 name "Services" from "Labs" to "Untrust"  "Any" "Any" "DNS" permit
set policy id 2 disable
set policy id 2
set service "FTP"
set service "HTTP"
set service "HTTPS"
set service "ICMP-ANY"
set service "MySSH"
set service "NTP"
set service "RSYNC"
exit
set nsmgmt bulkcli reboot-timeout 60
set ssh version v2
set config lock timeout 5
unset license-key auto-update
set ssl encrypt 3des sha-1
set ntp server "66.187.233.4"
set wlan 0 channel auto
set wlan 1 channel auto
set snmp port listen 161
set snmp port trap 162
set vrouter "untrust-vr"
set route 0.0.0.0/0 interface ethernet0/0 gateway 208.83.67.129 preference 20 permanent
exit
set vrouter "trust-vr"
unset add-default-route
set route 0.0.0.0/0 interface ethernet0/0 gateway 208.83.67.129 preference 20
exit
set vrouter "untrust-vr"
exit
set vrouter "trust-vr"
exit
 

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Interface Natting has the following conditions : 

 

1. Interface-based NAT on traffic from the Trust zone to the Untrust zone.

 

2. Interface-based NAT on traffic from the User-Defined zone to the Untrust zone.

(Note: This is possible only if the User-Defined and Untrust zones are in different virtual routing domains.)

 

3. No interface-based NAT on traffic between the Trust and User-Defined zones.

 

I think you hitting to the condition No.2 , please verify that they are in different VRs.

 

Thanks

Atif

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

HUH???

 

Why is the supplied zone 'Untrust' in the supplied vrouter 'trust-vr'?????  From reading the manual I would have expected this!  On page 96 of the manual there is this really nice graphic of the 'Trust' zone NATed to the 'Untrust' zone.

 

I feel this is a 'bug' in the default config.  Seems the 'easiest' way to fix this is to download the config, edit that one line to put the 'Untrust' zone into the 'untrust-vr' and upload the config.

 

Here goes.  If I hose it up, there is always re-initing the box again!

 

 

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

OOPS!

 

"From reading the manual I would **NOT** have expected this!"

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Above update is not clear for me.

 

IS the problem resolved or still exists.

 

Thanks

Atif

If this worked for you please flag my post as an "Accepted Solution" so others can benefit. A kudo would be cool if you think I earned it.
Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

I made the edit change, the zone 'Untrust' is now in the virtual router 'untrust-vr'.  I did not make any other change, and still not NATing working.

 

Smiley Sad

 

 

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

I will check in my lab setup . but just as a workaround use the "nat src" in the policy :

 

set policy id 3 name "Services" from "Labs" to "Untrust"  "Any" "Any" "ANY" nat src permit

 

Thanks

Atif

Highlighted
Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

This change did not make a difference.  Still nothing.

 

Since interface 0/1 is now in the untrust-vr, I also tried changing the default routing so that 0.0.0.0/0 from trust-vr goes to untrust-vr and 0.0.0.0/0 from untrust-vr goes to 208.83.67.129.  No difference.

 

How do I monitor traffic through a interface so I can see what the packets look like?

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

What firewall is it and what firmware are you running on it.

 

run the the following debug :

 

1) debug flow basic

2) set ff src-ip x.x.x.x

3) set ff dst-ip x.x.x.x

4) cl db

Run the ping test

5) undebug all

6) get db s

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

It is a SSG5w.

 

Hardware ver:    7.10(0)

Firmware ver:     6.0.0r4.0



1) debug flow basic

 

I am not familiar with these commands.  I am a Redhat Linux guy...

 

 

2) set ff src-ip x.x.x.x

3) set ff dst-ip x.x.x.x

 

 

 Are these filter commands, so that only packets with those addresses are shown?  What do I do with the NATing of the src?

 

4) cl db

Run the ping test

 

I know ping really well Smiley Happy  but what is the src-ip in the ping?  

 

5) undebug all

6) get db s

 

thanks for your help.

 

 

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Please follow the Kb which helps you to run the debug:

 

http://kb.juniper.net/KB5536

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

thanks.

 

Ran the debug, and I have thoughts.

 

Nowhere do I see the accessable address of interface 0/1, 208.83.67.134, either it is not nating, or it is putting the network address 208.83.67.128 in, and it looks like the latter.  I looked again at the manual, and in setting up the untrusted interface, nothing is said about what address will be used for NATing.  There is the VIP address, but that I thought was for the inward bound traffic to the internal mail server.  I am ASSuMEing that the management IP addr is used for NATing, and I could be wrong as the manual is silent on this (or I missed it).

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Based on the config and debug below , it is working fine

 

set interface "bgroup0" zone "Trust"
set interface bgroup0 ip 192.168.1.1/24
set interface bgroup0 nat

 

set interface "ethernet0/0" zone "Untrust"
set interface ethernet0/0 ip 208.83.67.128/29
set interface ethernet0/0 route

 

bgroup0:192.168.1.33/60793->208.83.64.5/53,17<Root>    <<<<=====Packet incoming Interface is bgroup0


routed (x_dst_ip 208.83.64.5) from bgroup0 (bgroup0 in 0) to ethernet0 <<<<===== Based on routing it selected ethernet0


dip id = 2, 192.168.1.33/60793->208.83.67.128/2316   <<<<===== Dip = 2 shows the interface based NAT from192 to 208.x.x.128

                                                                                                                      chosing ethernet0/0 interface IP address
choose interface ethernet0/0 as outgoing phy if  <<<<===== ethernet0/0 is selected as the outgoing interface

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Just pasting the sample debug config which explain how to read the debug :

 

Reading a Debug Flow Basic

 

FW-> get dbuf stream
****** 15625.0: <private/ethernet0/5> packet received [60]****** - This is the interface and zone that the packet arrives on
  ipid = 34344(8628), @02cdf8b0
  packet passed sanity check.
  ethernet0/5:10.1.1.5/17152->1.1.70.250/256,1(8/0)<Root> - This is the packet IP info ports and protocol
  no session found - Looks for existing sessions on the firewall
  flow_first_sanity_check: in <ethernet0/5>, out <N/A>
  chose interface ethernet0/5 as incoming nat if. - There is NAT on the interface
  flow_first_routing: in <ethernet0/5>, out <N/A>
  search route to (ethernet0/5, 10.1.1.5->1.1.70.250) in vr trust-vr for vsd-0/flag-0/ifp-null
  [ Dest] 10.route 1.1.70.250->0.0.0.0, to ethernet0/6 - matches route 10 in the trust-vr routing table
  routed (x_dst_ip 1.1.70.250) from ethernet0/5 (ethernet0/5 in 0) to ethernet0/6
  policy search from zone 104-> zone 103 - Tells you which policy set its going to look at zone to zone derived from routing
 policy_flow_search  policy search nat_crt from zone 104-> zone 103
  RPC Mapping Table search returned 0 matched service(s) for (vsys Root, ip 1.1.70.250, port 2396, proto 1)
  No SW RPC rule match, search HW rule
  Permitted by policy 2 - Tells you which policy the traffic has hit and what the action is
  No src xlate   choose interface ethernet0/6 as outgoing phy if
  no loop on ifp ethernet0/6.
  session application type 0, name None, nas_id 0, timeout 60sec
  service lookup identified service 0.
  flow_first_final_check: in <ethernet0/5>, out <ethernet0/6>
  existing vector list 1-4339cf0.
  Session (id:8061) created for first pak 1 - session created for future packes in the session
  flow_first_install_session======>
  route to 1.1.70.250
  arp entry found for 1.1.70.250 - firewall arps for where it is going to route packet to.
  nsp2 wing prepared, ready
  cache mac in the session
  make_nsp_ready_no_resolve()
  search route to (ethernet0/6, 1.1.70.250->10.1.1.5) in vr trust-vr for vsd-0/flag-3000/ifp-ethernet0/5
  [ Dest] 12.route 10.1.1.5->0.0.0.0, to ethernet0/5
  route to 10.1.1.5
  flow got session.
  flow session id 8061
  post addr xlation: 10.1.1.5->1.1.70.250. - shows if there has been and address translation and how the packet looks when it is sent out.

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

OK.  I got on the router and did a tcpdump and saw that the NATing is putting the source address to 208.83.67.128, which is the Network address, not the address I want, of 208.83.67.134.

 

the interface is defined with:

 

set interface ethernet0/0 ip 208.83.67.128/29

 

I do have:

 

set interface ethernet0/0 manage-ip 208.83.67.134

 

Obviously I need more.  what VIP?

 

 

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

Please use the MIp and follow the following link :

http://kb.juniper.net/KB10923

 

Thanks

Atif

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

MIP is one-to-one NATing, not having a single public address for all internal 1918 addressed devices.

 

I am ready to throw in the towel, re-init, run the wizard 'out of the box' and then learn from the resulting config to then set up what I need...

 

Manual needs some work!

Super Contributor
Posts: 287
Registered: ‎10-21-2008
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

You have to use the Dip with PAT .

 

Please the following link:

http://www.juniper.net/techpubs/software/screenos/screenos6.1.0/ce_v8.pdf Page 15

 

http://kb.juniper.net/KB11901

 

Thanks

Atif

 

Super Contributor
Posts: 287
Registered: ‎10-21-2008

Re: NATed Interface from manual example not working on SSG5w

You have to use the Dip with PAT .

 

Please the following link:

http://www.juniper.net/techpubs/software/screenos/screenos6.1.0/ce_v8.pdf Page 15

 

http://kb.juniper.net/KB11901

 

Thanks

Atif

If this worked for you please flag my post as an "Accepted Solution" so others can benefit. A kudo would be cool if you think I earned it.

Contributor
Posts: 46
Registered: ‎08-26-2009
0 Kudos

Re: NATed Interface from manual example not working on SSG5w

OK.  Got PNAT working, though I don't like PNAT or the way Juniper implements it.

 

I eat up another IP address.  One for management and one for PNATing.  There is no reason they can't be the same, but the GUI won't let me select the management IP for DIP.

 

For right now this is OK, as I have a public-facing subnet.  But my plan is that the firewall will take over the ADSL and PPPoE duties now performed by a DSL router in brdige mode and a Linux box running as a PPPoE client and internal router (IPv4 and IPv6).  So I will only have the one address my ISP is assigning for the PPPoE interface.

 

So you got me a solution.  Thanks!  I did not read Vol 8; shame on me, only the NATing info in Vol 2 of the manual.

 

Tomorrow, I am going to save this config, then re-init and see what I get from a raw install.