firehol-router - create a router definition
{ router | router46 } name rule-params
router4 name rule-params
router6 name rule-params
A router
definition consists of a set of rules for traffic passing through the host running the firewall.
The default policy for router definitions is RETURN, meaning packets are not dropped by any particular router. Packets not matched by any router are dropped at the end of the firewall.
The behaviour of the defined router is controlled by adding subcommands from those listed in ROUTER SUBCOMMANDS.
Note
Writing
router4
is equivalent to writingipv4 router
and ensures the defined router is created only in the IPv4 firewall along with any rules within it.Writing
router6
is equivalent to writingipv6 router
and ensures the defined router is created only in the IPv6 firewall along with any rules within it.Writing
router46
is equivalent to writingboth router
and ensures the defined router is created in both the IPv4 and IPv6 firewalls. Any rules within it will also be applied to both, unless they specify otherwise.
This is a name for this router. You should use short names (10 characters maximum) without spaces or other symbols.
A name should be unique for all FireHOL interface and router definitions.
The set of rule parameters to further restrict the traffic that is matched to this router.
See firehol-params(5) for information on the parameters that can be used. Some examples:
router mylan inface ppp+ outface eth0 src not ${UNROUTABLE_IPS}
router myrouter
See firehol.conf(5) for an explanation of ${UNROUTABLE_IPS}.
Routers create stateful iptables(8) rules which match traffic in both directions.
To match some client or server traffic, the input/output interface or source/destination of the request must be specified. All inface
/outface
and src
/dst
firehol-params(5) can be given on the router statement (in which case they will be applied to all subcommands for the router) or just within the subcommands of the router.
For example, to define a router which matches requests from any PPP interface and destined for eth0, and on this allowing HTTP servers (on eth0) to be accessed by clients (from PPP) and SMTP clients (from eth0) to access any servers (on PPP):
router mylan inface ppp+ outface eth0
server http accept
client smtp accept
Note
The
client
subcommand reverses any optional rule parameters passed to therouter
, in this case theinface
andoutface
.
Equivalently, to define a router which matches all forwarded traffic and within the the router allow HTTP servers on eth0 to be accessible to PPP and any SMTP servers on PPP to be accessible from eth0:
router mylan
server http accept inface ppp+ outface eth0
server smtp accept inface eth0 outface ppp
Note
In this instance two
server
subcommands are used since there are no parameters on therouter
to reverse. Avoid the use of theclient
subcommand in routers unless the inputs and outputs are defined as part of therouter
.
Any number of routers can be defined and the traffic they match can overlap. Since the default policy is RETURN, any traffic that is not matched by any rules in one will proceed to the next, in order, until none are left.