To verify a firewall filter configuration, perform these tasks:
Verify the configuration of the firewall filter. You can analyze the flow of the firewall filter terms by displaying the entire configuration.
From the J-Web interface, select Configuration>View and Edit>View Configuration Text. Alternatively, from configuration mode in the CLI, enter the show services or show firewall command for stateful and stateless firewall filters.
The sample output in this section displays the following firewall filters (in order):
- [edit]
- user@host# show services
- stateful-firewall
-
- rule to-wan-rule {
- match-direction output;
-
- term app-term {
-
- from {
- application-sets junos-algs-outbound;
- }
-
- then {
- accept;
- }
- }
-
- term accept-all-term {
-
- then {
- accept;
- }
- }
- }
-
- rule from-wan-rule {
- match-direction input;
-
- term wan-src-addr-term {
-
- from {
-
- source-address {
- 192.168.33.0/24;
- }
- }
-
- then {
- accept;
- }
- }
-
- term discard-all-term {
-
- then {
- discard;
- }
- }
- }
- }
- nat {
-
- pool public-pool {
- address-range low 10.148.2.1 high 10.148.2.32;
- port automatic;
- }
-
- rule nat-to-wan-rule {
- match-direction output;
-
- term private-public-term {
-
- then {
-
- translated {
- source-pool public-pool;
- translation-type source dynamic;
- }
- }
- }
- }
- }
- service-set wan-service-set {
- stateful-firewall-rules to-wan-rule;
- stateful-firewall-rules from-wan-rule;
- nat-rules nat-to-wan-rule;
-
- interface-service {
- service-interface sp-0/0/0;
- }
- }
-
- [edit]
- user@host# show firewall
- firewall {
-
- family inet {
-
- filter protect-RE {
-
- term ssh-term {
-
- from {
-
- source-address {
- 192.168.122.0/24;
- }
- protocol tcp;
- destination-port ssh;
- }
- then accept;
- }
-
- term bgp-term {
-
- from {
-
- source-address {
- 10.2.1.0/24;
- }
- protocol tcp;
- destination-port bgp;
- }
- then accept;
- }
-
- term discard-rest-term {
-
- then {
- log;
- syslog;
- discard;
- }
- }
- }
- }
- }
-
- [edit]
- user@host# show firewall
- firewall {
-
- policer tcp-connection-policer {
- filter-specific;
-
- if-exceeding {
- bandwidth-limit 500k;
- burst-size-limit 15k;
- }
- then discard;
- }
-
- policer icmp-policer {
- filter-specific;
-
- if-exceeding {
- bandwidth-limit 1m;
- burst-size-limit 15k;
- }
- then discard;
- }
-
- family inet {
-
- filter protect-RE {
-
- term tcp-connection-term {
-
- from {
-
- source-prefix-list {
- trusted-addresses;
- }
- protocol tcp;
- tcp-flags “(syn & !ack) | fin | rst”;
- }
-
- then {
- policer tcp-connection-policer;
- accept;
- }
- }
-
- term icmp-term {
-
- from {
- protocol icmp;
- icmp-type [ echo-request echo-reply unreachable time-exceeded ];
- }
-
- then {
- policer icmp-policer;
- count icmp-counter;
- accept;
- }
- }
-
additional terms...
- }
- }
- }
-
- [edit]
- user@host# show firewall
- firewall {
-
- family inet {
-
- filter fragment-RE {
-
- term small-offset-term {
-
- from {
- fragment-offset 1-5;
- }
-
- then {
- syslog;
- discard;
- }
- }
-
- term not-fragmented-term {
-
- from {
-
- source-address {
- 10.2.1.0/24;
- }
- fragment-offset 0;
- fragment-flags 0x0;
- protocol tcp;
- destination-port bgp;
- }
- then accept;
- }
-
- term first-fragment-term {
-
- from {
-
- source-address {
- 10.2.1.0/24;
- }
- first-fragment;
- protocol tcp;
- destination-port bgp;
- }
- then accept;
- }
-
- term fragment-term {
-
- from {
- fragment-offset 6-8191;
- }
- then accept;
- }
-
additional terms ...
- }
- }
- }
-
Verify that the output shows the intended configuration of the firewall filter. For more information about the format of a configuration file, see Viewing the Configuration Text.
Verify that the terms are listed in the order in which you want the packets to be tested. You can move terms within a firewall filter by using the insert CLI command. For more information, see Inserting an Identifier.
Verifying a Stateful Firewall FilterVerify the firewall filter configured in Configuring a Stateful Firewall Filter with a Configuration Editor.
To verify that the actions of the firewall filter terms are taken, send packets to and from the untrusted network that match the terms. In addition, verify that actions are not taken for packets that do not match.
For example, send a ping request from host trusted-nw-trusted-host to host untrusted-nw-untrusted-host, and verify that a ping response is returned. Ping requests and responses use ICMP, which belongs to the junos-algs-outbound application set.
![]() |
To view the configuration of junos-algs-outbound, enter the show groups junos-defaults applications application-set junos-algs-outbound configuration mode command. |
For example, send a ping request from host untrusted-nw-trusted-host with an IP address that matches 192.168.33.0/24 to host trusted-nw-trusted-host, and verify that a ping response is returned.
Verify that the ping response displays an IP address from the configured NAT pool.
user@trusted-nw-trusted-host> ping untrusted-nw-untrusted-host
PING untrusted-nw-untrusted-host.acme.net (172.69.13.5): 56 data bytes 64 bytes from 192.169.13.5: icmp_seq=0 ttl=22 time=8.238 ms 64 bytes from 192.169.13.5: icmp_seq=1 ttl=22 time=9.116 ms 64 bytes from 192.169.13.5: icmp_seq=2 ttl=22 time=10.875 ms ...
user@untrusted-nw-trusted-host> ping trusted-nw-trusted-host
PING trusted-nw-trusted-host-fe-000.acme.net (112.148.2.3): 56 data bytes 64 bytes from 10.148.2.3: icmp_seq=0 ttl=253 time=18.248 ms 64 bytes from 10.148.2.3: icmp_seq=1 ttl=253 time=10.906 ms 64 bytes from 10.148.2.3: icmp_seq=2 ttl=253 time=12.845 ms ...
Verify the following information:
For information about using the J-Web interface to ping a host, see the J-series Services Router Administration Guide.
For more information about the ping command, see the J-series Services Router Administration Guide or the JUNOS Protocols, Class of Service, and System Basics Command Reference.
Displaying Firewall Filter LogsVerify that packets are being logged. If you included the log or syslog action in a term, verify that packets matching the term are recorded in the firewall log or your system logging facility.
From operational mode in the CLI, enter the show firewall log command.
The log of discarded packets generated from the firewall filter configured in Configuring a Routing Engine Firewall Filter for Services and Protocols from Trusted Sources is displayed in the following sample output.
user@host> show firewall log
Log : Time Filter Action Interface Protocol Src Addr Dest Addr 15:11:02 pfe D fe-0/0/0.0 TCP 172.17.28.19 192.168.70.71 15:11:01 pfe D fe-0/0/0.0 TCP 172.17.28.19 192.168.70.71 15:11:01 pfe D fe-0/0/0.0 TCP 172.17.28.19 192.168.70.71 15:11:01 pfe D fe-0/0/0.0 TCP 172.17.28.19 192.168.70.71 ...
Each record of the output contains information about the logged packet. Verify the following information:
For more information about the show firewall log command, see the JUNOS Protocols, Class of Service, and System Basics Command Reference.
Displaying Firewall Filter StatisticsVerify that packets are being policed and counted.
From operational mode in the CLI, enter the show firewall filter filter-name command.
The value of the counter, icmp-counter, and the number of packets discarded by the policers in the firewall filter configured in Configuring a Routing Engine Firewall Filter to Protect Against TCP and ICMP Floods are displayed in the following sample output.
user@host> show firewall filter protect-RE
Filter: protect-RE Counters: Name Bytes Packets icmp-counter 1040000 5600 Policers: Name Packets tcp-connection-policer 643254873 icmp-policer 7391
Verify the following information:
For more information about the show firewall filter command, see the JUNOS Protocols, Class of Service, and System Basics Command Reference.
Verifying a Services, Protocols, and Trusted Sources Firewall FilterVerify the firewall filter configured in Configuring a Routing Engine Firewall Filter for Services and Protocols from Trusted Sources.
To verify that the actions of the firewall filter terms are taken, send packets to the Services Router that match the terms. In addition, verify that the filter actions are not taken for packets that do not match.
% ssh 192.168.249.71
%ssh host user@host's password: --- JUNOS 6.4-20040518.0 (JSERIES) #0: 2004-05-18 09:27:50 UTC user@host>
user@host> show route summary
Router ID: 192.168.249.71
inet.0: 34 destinations, 34 routes (33 active, 0 holddown, 1 hidden)
Direct: 10 routes, 9 active
Local: 9 routes, 9 active
BGP: 10 routes, 10 active
Static: 5 routes, 5 active
...
Verify the following information:
For more information about the show route summary command, see the JUNOS Protocols, Class of Service, and System Basics Command Reference.
Verifying a TCP and ICMP Flood Firewall FilterVerify the firewall filter configured in Configuring a Routing Engine Firewall Filter to Protect Against TCP and ICMP Floods.
To verify that the actions of the firewall filter terms are taken, send packets to the Services Router that match the terms. In addition, verify that the filter actions are not taken for packets that do not match.
user@host> telnet 192.168.249.71
Trying 192.168.249.71... Connected to host.acme.net. Escape character is '^]'. host (ttyp0) login: user Password: --- JUNOS 6.4-20040521.1 built 2004-05-21 09:38:12 UTC user@host>
user@host> ping 192.168.249.71
PING host-fe-000.acme.net (192.168.249.71): 56 data bytes 64 bytes from 192.168.249.71: icmp_seq=0 ttl=253 time=11.946 ms 64 bytes from 192.168.249.71: icmp_seq=1 ttl=253 time=19.474 ms 64 bytes from 192.168.249.71: icmp_seq=2 ttl=253 time=14.639 ms ...
user@host> ping 192.168.249.71 size 20000
PING host-fe-000.acme.net (192.168.249.71): 20000 data bytes ^C --- host-fe-000.acme.net ping statistics --- 12 packets transmitted, 0 packets received, 100% packet loss
Verify the following information:
For more information about the ping command, see the J-series Services Router Administration Guide or the JUNOS Protocols, Class of Service, and System Basics Command Reference.
For information about using the J-Web interface to ping a host, see the J-series Services Router Administration Guide.
For more information about the telnet command, see the J-series Services Router Administration Guide or the JUNOS Protocols, Class of Service, and System Basics Command Reference.
Verifying a Firewall Filter That Handles FragmentsVerify the firewall filter configured in Configuring a Routing Engine Firewall Filter to Handle Fragments.
To verify that the actions of the firewall filter terms are taken, send packets to the Services Router that match the terms. In addition, verify that the filter actions are not taken for packets that do not match.
user@host> show route summary
Router ID: 192.168.249.71
inet.0: 34 destinations, 34 routes (33 active, 0 holddown, 1 hidden)
Direct: 10 routes, 9 active
Local: 9 routes, 9 active
BGP: 10 routes, 10 active
Static: 5 routes, 5 active
...
Verify that the show route summary command does not display a protocol other than Direct, Local, BGP, or Static. For more information about the show route summary command, see the JUNOS Protocols, Class of Service, and System Basics Command Reference.