Skip to content
Smarter by Design.Simpler for Business

network fw-rule ​

The network fw-rule command manages the firewall rules to be applied to the traffic that passes through an interface. Every rule consists of an action (allow, block, NAT) and the source, target and port matches. Its panel equivalent is the firewall screen in the network configuration.

Command Summary ​

TR7 WEB-CLI · network fw-rule
# Tab after the command
admin@TR7LBWAF01> network fw-rule
add delete list show update
 
admin@TR7LBWAF01> network fw-rule list v-device <device> # list them all
admin@TR7LBWAF01> network fw-rule show v-device <device> <id> # show one
admin@TR7LBWAF01> network fw-rule add v-device <device> namespace <table> …
admin@TR7LBWAF01> network fw-rule update v-device <device> id <id> … # change
admin@TR7LBWAF01> network fw-rule delete v-device <device> <id> # delete
admin@TR7LBWAF01>  

Required Fields ​

OrderFieldStatusWhat it doesWhat is written after it
1v-deviceRequiredSelects to which virtual device the rule will be writtenThe virtual device
2namespaceRequiredSelects in which routing table the rule will be validA network namespace record
3interfaceRequiredSelects on which interface the rule will be appliedAn interface record or null (independent of the interface)
4ruleRequiredSelects what the rule will doallow · deny · forward · notForward · snat · dnat
5snatIp.typeConditionally requiredOnly rule snat; selects where the address to be used in the source address translation will be taken fromdeviceIp the address of the device · manual the manually written address
6snatIp.deviceIpConditionally requiredOnly rule snat and snatIp.type deviceIp; the device address to be used in the translationThe device address
5dnatIpConditionally requiredOnly rule dnat; the address to which the packet will be forwardedThe IP address
6 · 7srcIp.typeRequiredSelects the form of the source match (in the snat and dnat rules it is asked for after the NAT fields)$all all of them · null the manually written address · country the country · mac the MAC address
7 · 8dstIp.typeRequiredSelects the form of the target match$all all of them · null the manually written address · country the country · deviceIp the address of the device

The first four fields and the two match types are always written without a prefix. The NAT fields are asked for only in their own actions: if there is a field that starts with -- on the line, they are written in the --snatIp.deviceIp and --dnatIp form.

The Source Match ​

FieldWhat it doesWhat is written after it
srcIp.typeSelects how the source will be matched$all · the manually written address · country · mac
--srcIp.manualContentDetermines the manually written source addressThe IP address; it opens when the type is manual writing
--srcIp.countryDetermines the country of the sourceThe country value; it opens while srcIp.type country
--srcIp.macDetermines the MAC address of the sourceThe MAC address; it opens while srcIp.type mac
--srcIp.negateNegates the match: the rule is applied to the sources outside the stated onetrue · false (the default is false). It does not open when srcIp.type $all is selected

The Target Match ​

FieldWhat it doesWhat is written after it
dstIp.typeSelects how the target will be matched$all · the manually written address · country · deviceIp
--dstIp.manualContentDetermines the manually written target addressThe IP address
--dstIp.countryDetermines the country of the targetThe country value; it opens while dstIp.type country
--dstIp.deviceIpSelects which address of the device will count as the targetThe device address; it opens while dstIp.type deviceIp
--dstIp.negateNegates the matchtrue · false (the default is false). It does not open when dstIp.type $all is selected

The Port and the Protocol ​

FieldWhat it doesWhat is written after it
--protocolSelects to which protocol the rule will be appliedThe protocol value; Tab lists them
--dstPort.typeSelects how the target port will be matched$all all of them · the manually written port. It opens only when --protocol tcp is selected
--dstPort.manualContentDetermines the manually written target portThe port number. It opens only when --protocol tcp is selected
--dstPort.negateNegates the port matchtrue · false (the default is false). It does not open when dstPort.type $all is selected. It opens only when --protocol tcp is selected

NAT and the Other Fields ​

FieldWhat it doesWhat is written after it
--dnatIpDetermines the address to which the packet will be forwarded in the target address translationThe IP address; it is required when rule dnat is selected (see The Required Fields)
--snatIp.deviceIpSelects the device address to be used in the source address translationThe device address; it is required while rule snat and snatIp.type deviceIp (see The Required Fields)
--snatIp.manualContentDetermines the manually written address in the source address translationThe IP address
--statusDetermines whether the rule is enabled or nottrue (the default) · false
--descWrites an explanation for the ruleFree text

Negating means "the ones outside this"

When --srcIp.negate true is written, the rule is applied to the traffic that does not fit the stated source. All three of the match fields have their own negation switch and none of them opens when $all is selected — the negation of a match that covers all of them would be an empty set.

Examples ​

TR7 WEB-CLI · A) Allowing a certain network
admin@TR7LBWAF01> network fw-rule add v-device Host namespace DEFAULT interface <interface> \
rule allow srcIp.type null dstIp.type $all \
--srcIp.manualContent 10.0.1.0 --protocol tcp --dstPort.type null --dstPort.manualContent 443 \
--desc "management access"
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) A rule for the sources outside a country
# with negate, "everywhere outside this country"
admin@TR7LBWAF01> network fw-rule add v-device Host namespace DEFAULT interface <interface> \
rule deny srcIp.type country dstIp.type $all \
--srcIp.country <country> --srcIp.negate true
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) Target address translation and turning the rule off
admin@TR7LBWAF01> network fw-rule add v-device Host namespace DEFAULT interface <interface> \
rule dnat srcIp.type $all dstIp.type deviceIp \
--dstIp.deviceIp <address> --dnatIp 10.0.10.21
 
admin@TR7LBWAF01> network fw-rule update v-device Host id <id> --status false
admin@TR7LBWAF01> network fw-rule delete v-device Host <id>
admin@TR7LBWAF01>  

Things to Know ​

  • The required fields are written without a prefix and in order. The virtual device, the routing table, the interface, the action and the two match types are always without a prefix; the CLI does not accept a field that starts with -- before these are completed.
  • The NAT fields depend on the action. The snatIp.type is asked for only when rule snat and the dnatIp only when rule dnat is selected; in the other actions they are not written.
  • The interface can be null. If the rule will be valid in the whole of the routing table without being bound to a certain interface, null is written in the interface field.
  • Negating cannot be used together with $all. None of the three negate fields appears in the completion list when the related type is $all.
  • Turning the rule off does not delete it. The --status false leaves the rule in the configuration, it only stops it from being applied.
  • The DNAT address is asked for only in the DNAT action. The --dnatIp does not open in the other actions.