Example: Configuring A Stateless Firewall Filter On An Interface Group - Juniper Networks
Example: Configuring A Stateless Firewall Filter On An Interface Group - Juniper Networks
Why Juniper? Products & Solu!ons Support Training Search Juniper.net Trials
/
TechLibrary Day One+ Product Documentation Design Center Learning Center Tools & Applications
Home TechLibrary Junos OS Routing Policies, Firewall Filters, and Traffic Policers User Guide
Junos OS
Interface Group
Beta
English
Filter by !tle *
! 17-Jun-22 " Product and Release Support
Filter Counters #$%&' (
Example: Configuring a ON THIS PAGE
Stateless Firewall Filter on Firewall filters are essen!al for securing a network and simplifying network management. In Junos OS, you can configure
Requirements
an Interface Group a stateless firewall filters to control the transit of data packets through the system and to manipulate packets as
Overview
necessary. Applying a stateless firewall filter to an interface group helps to filter packets transi!ng through each interface
/ Configuring Filter-Based Configura!on
in the interface group. This example shows how to configure a standard stateless firewall filter to match packets tagged
Tunneling Across IP Networks Verifica!on
for a par!cular interface group.
/ Configuring Service Filters
NOTE: When you apply a firewall filter to a loopback interface, the interface filters all the packets des!ned to
the Rou!ng Engine.
CLI Quick Configura!on shows the configura!on for all of the devices in Figure 1. The sec!on Step-by-Step Procedure
describes the steps on Device R1.
Configura!on
CLI Quick Configura!on
Results
Device R0
, -
Device R1
, -
set firewall family inet filter filter_if_group term term1 then log
set firewall family inet filter filter_if_group term term1 then reject
set firewall family inet filter filter_if_group term term2 from protocol icmp
set firewall family inet filter filter_if_group term term2 then count if_group_counter2
set firewall family inet filter filter_if_group term term2 then log
set firewall family inet filter filter_if_group term term2 then accept
set firewall family inet filter filter_if_group term term3 then count default
set interfaces ge-0/0/0 unit 0 family inet filter group 1
set interfaces ge-0/0/0 unit 0 family inet address 172.16.17.2/30
set interfaces ge-0/0/1 unit 0 family inet address 172.16.19.2/30
set interfaces ge-0/0/2 unit 0 family inet filter group 1
set interfaces ge-0/0/2 unit 0 family inet address 20.1.1.2/30
set interfaces lo0 unit 0 family inet address 20.0.0.1/32
set forwarding-options family inet filter input filter_if_group Show more
Step-by-Step Procedure
The following example requires you to navigate various levels in the configura!on hierarchy. For informa!on about
naviga!ng the CLI, see Use the CLI Editor in Configura!on Mode in the CLI User Guide.
, -
[edit firewall]
user@R1# edit family inet filter filter_if_group
, -
[edit interfaces]
user@R1# set ge-0/0/0 unit 0 family inet filter group 1
user@R1# set ge-0/0/0 unit 0 family inet address 172.16.17.2/30
user@R1# set ge 0/0/1 unit 0 family inet address 172.16.19.2/30
user@R1# set ge-0/0/2 unit 0 family inet filter group 1
user@R1# set ge-0/0/2 unit 0 family inet address 20.1.1.2/30
user@R1# set lo0 unit 0 family inet address 20.0.0.1/32
3. Configure term term1 to match packets received on interface group 1 and with the ICMP protocol.
, -
[edit firewall]
user@R1# set family inet filter filter_if_group term term1 from interface-group 1
user@R1# set family inet filter filter_if_group term term1 from protocol icmp
4. Configure term term1 to count, log, and reject all the matching packets.
, -
[edit firewall]
user@R1# set family inet filter filter_if_group term term1 then count if_group_counter1
user@R1# set family inet filter filter_if_group term term1 then log
user@R1# set family inet filter filter_if_group term term1 then reject
, -
[edit firewall]
user@R1# set family inet filter filter_if_group term term2 from protocol icmp
6. Configure term term2 to count, log, and accept all the matching packets.
, -
[edit firewall]
user@R1# set family inet filter filter_if_group term term2 then count if_group_counter2
user@R1# set family inet filter filter_if_group term term2 then log
user@R1# set family inet filter filter_if_group term term2 then accept
, -
[edit firewall]
user@R1# set family inet filter filter_if_group term term3 then count default
8. Apply the firewall filter to the router’s (or switch’s) interface group by applying it to the rou!ng instance.
, -
[edit]
user@R1# set forwarding-options family inet filter input filter_if_group
9. If you are done configuring the device, commit your candidate configura!on.
, -
[edit]
user@host# commit
Results
From configura!on mode, confirm your configura!on by issuing the show interfaces, show firewall, and show forwarding-
options commands. If the output does not display the intended configura!on, repeat the instruc!ons in this example to
correct the configura!on.
, -
[edit]
user@R1# show interfaces
ge-0/0/0 {
unit 0 {
family inet {
filter {
group 1;
}
address 172.16.17.2/30;
}
}
}
Show more
ge-0/0/1 {
, -
[edit]
user@R1# show firewall
family inet {
filter filter_if_group {
term term1 {
from {
interface-group 1;
protocol icmp;
}
then {
count if_group_counter1;
log;
Show more
reject;
, -
[edit]
user@R1# show forwarding-options
family inet {
filter {
input filter_if_group;
}
}
Verifica!on
Confirm that the configura!on is working properly.
Purpose
Ac!on
Meaning
Purpose
Verify that the interfaces are properly configured.
Ac!on
To display the state of the interfaces, use the show interfaces terse opera!onal mode command.
Device R0
, -
Device R1
, -
Meaning
All the interfaces on Devices R0 and R1 are physically connected and up. The interface group 1 on Device R1 consists of
two interfaces, namely ge-0/0/0.0 and ge-0/0/2.0.
Purpose
Ac!on
Meaning
Purpose
Verify that the firewall filter match condi!ons are configured properly.
Ac!on
To display the firewall filter counters, enter the show firewall filter filter_if_group opera!onal mode command.
, -
Filter: filter_if_group
Counters:
Name Bytes Packets
default 192975 3396
if_group_counter1 2520 30
if_group_counter2 2604 41
To display the local log of packet headers for packets evaluated by the firewall filter, enter the show firewall log
opera!onal mode command.
, -
To make sure that the firewall filters are ac!ve on interface group 1 on Device R1, use the ping <address> opera!onal
mode command on the CLI of Device R0.
, -
, -
To make sure that the firewall filter is not applied on an interface that is not in interface group 1, use the ping
<address> opera!onal mode command on the CLI of Device R0.
, -
Meaning
The stateless firewall filter is applied to all interfaces in interface group 1. The term term1 match condi!on in the stateless
firewall filter counts, logs, and rejects packets that are received on or sent from the interfaces in interface group 1 and
with a source ICMP protocol. The term term2 match condi!on matches packets tagged with the ICMP protocol and
counts, logs, and accepts those packets. The term term3 match condi!on counts all the transit packets.
RELATED DOCUMENTATION
Related Informa!on Configuring Firewall Filters (CLI Procedure) Stateless Firewall Filter Overview Example: Configuring a Firewall Filter on a...
Events
Contact Us
Contacts Feedback Site Map Privacy Policy Legal No!ces DMCA Policy Cookie ⾸选项
0 Feedback