Under Construction

Anzeigen von Filter-Regeln (lsfilt)

Mit dem Kommando lsfilt kann entweder der Inhalt der Filter-Regel-Tabelle oder die aktiven Filter-Regeln im Kernel angezeigt werden. Standardmäßig (ohne Option „-a“) wird die Filter-Regel-Tabelle (ODM ipsec_filter) angzeigt:

# lsfilt
Beginning of IPv4 filter rules.
Rule 1:
Rule action         : permit
Source Address      : 0.0.0.0
Source Mask         : 0.0.0.0
Destination Address : 0.0.0.0
Destination Mask    : 0.0.0.0
Source Routing      : no
Protocol            : udp
Source Port         : eq  4001
Destination Port    : eq  4001
Scope               : both
Direction           : both
Logging control     : no
Fragment control    : all packets
Tunnel ID number    : 0
Interface           : all
Auto-Generated      : yes
Expiration Time     : 0
Description         : Default Rule

End of IPv4 filter rules.

Beginning of IPv6 filter rules.
Rule 1:
*** Dynamic filter placement rule for IKE tunnels ***
Logging control     : no

Rule 0:
Rule action         : deny
Source Address      : ::
Source Mask         : 0
Destination Address : ::
Destination Mask    : 0
Source Routing      : yes
Protocol            : all
Source Port         : any 0
Destination Port    : any 0
Scope               : both
Direction           : both
Logging control     : no
Fragment control    : all packets
Tunnel ID number    : 0
Interface           : all
Auto-Generated      : no
Expiration Time     : 0
Description         : Default Rule

End of IPv6 filter rules.
#

Es werden sowohl die IPv4 Filter-Regeln, als auch die IPv6 Filter-Regeln angezeigt. Über die Option „-v“ kann die Ausgabe auf IPv4 („-v 4“) oder IPv6 („-v 6“) eingeschränkt werden:

# lsfilt -v 6
Beginning of IPv6 filter rules.
Rule 1:
*** Dynamic filter placement rule for IKE tunnels ***
Logging control     : no

Rule 0:
Rule action         : deny
Source Address      : ::
Source Mask         : 0
Destination Address : ::
Destination Mask    : 0
Source Routing      : yes
Protocol            : all
Source Port         : any 0
Destination Port    : any 0
Scope               : both
Direction           : both
Logging control     : no
Fragment control    : all packets
Tunnel ID number    : 0
Interface           : all
Auto-Generated      : no
Expiration Time     : 0
Description         : Default Rule

End of IPv6 filter rules.
#

Die Standard-Ausgabe ist sehr lang, insbesondere wenn es eine größere Anzahl von Filter-Regeln gibt. Eine kompaktere Darstellung, bei der für jede Filter-Regel nur eine Zeile verwendet wird, kann durch Angabe der Option „-O“ erreicht werden. Hier eine Beispiel-Ausgabe für die IPv4 Filter-Regeln aus der Filter-Regel-Tabelle:

# lsfilt -v 4 -O
1|permit|0.0.0.0|0.0.0.0|0.0.0.0|0.0.0.0|no|udp|eq|4001|eq|4001|both|both|no|all packets|0|all|0|||Default Rule
2|*** Dynamic filter placement rule for IKE tunnels ***|no
3|permit|10.222.16.155|255.255.255.255|0.0.0.0|0.0.0.0|yes|all|any|0|any|0|both|outbound|no|all packets|0|all|0|||allow all outbound packets
4|deny|10.20.170.250|255.255.255.255|10.222.16.155|255.255.255.255|yes|tcp|any|0|eq|22|both|inbound|yes|all packets|0|all|0|||
5|permit|10.16.207.91|255.255.255.255|10.222.16.155|255.255.255.255|yes|udp|any|0|eq|657|both|inbound|yes|all packets|0|all|0|||
6|permit|10.16.207.92|255.255.255.255|10.222.16.155|255.255.255.255|yes|udp|any|0|eq|657|both|inbound|yes|all packets|0|all|0|||
0|permit|0.0.0.0|0.0.0.0|0.0.0.0|0.0.0.0|yes|all|any|0|any|0|both|both|no|all packets|0|all|0|||Default Rule
#

Sollen die aktiven Filter-Regeln im Kernel angezeigt werden, muss die Option „-a“ (active filter rules) angegeben werden:

# lsfilt -v 4 -O -a
1|*** Dynamic filter placement rule for IKE tunnels ***|no
2|permit|10.222.16.155|255.255.255.255|0.0.0.0|0.0.0.0|yes|all|any|0|any|0|both|outbound|no|all packets|0|all|0|||
3|deny|10.20.170.250|255.255.255.255|10.222.16.155|255.255.255.255|yes|tcp|any|0|eq|22|both|inbound|yes|all packets|0|all|0|||
4|permit|10.16.207.91|255.255.255.255|10.222.16.155|255.255.255.255|yes|udp|any|0|eq|657|both|inbound|yes|all packets|0|all|0|||
5|permit|10.16.207.92|255.255.255.255|10.222.16.155|255.255.255.255|yes|udp|any|0|eq|657|both|inbound|yes|all packets|0|all|0|||
6|permit|0.0.0.0|0.0.0.0|0.0.0.0|0.0.0.0|yes|all|any|0|any|0|both|both|no|all packets|0|all|0|||
#

Hinweis: Die Option „-a“ kann nur mit den Optionen „-v“ und „-O“ kombiniert werden!

Möchte man sich einzelne Regeln genauer anschauen, ist die Option „-n“ sehr nützlich. Es können eine oder mehrere Regel IDs (getrennt durch Komma oder Leerzeichen) angegeben werden. Es werden dann nur die angegebenen Filter-Regeln angezeigt:

# lsfilt -v 4 -n 4,6
Rule 4:
Rule action         : deny
Source Address      : 10.20.170.250
Source Mask         : 255.255.255.255
Destination Address : 10.222.16.155
Destination Mask    : 255.255.255.255
Source Routing      : yes
Protocol            : tcp
Source Port         : any 0
Destination Port    : eq  22
Scope               : both
Direction           : inbound
Logging control     : yes
Fragment control    : all packets
Tunnel ID number    : 0
Interface           : all
Auto-Generated      : no
Expiration Time     : 0
Description         :

Rule 6:
Rule action         : permit
Source Address      : 10.16.207.92
Source Mask         : 255.255.255.255
Destination Address : 10.222.16.155
Destination Mask    : 255.255.255.255
Source Routing      : yes
Protocol            : udp
Source Port         : any 0
Destination Port    : eq  657
Scope               : both
Direction           : inbound
Logging control     : yes
Fragment control    : all packets
Tunnel ID number    : 0
Interface           : all
Auto-Generated      : no
Expiration Time     : 0
Description         :

#

Hinweis: Die Option „-n“ kann nicht mit der Option „-a“ für aktive Filter-Regeln kombiniert werden.