2075
Комментарий:
|
2744
|
Удаления помечены так. | Добавления помечены так. |
Строка 11: | Строка 11: |
* check-state (+первое правило с keep-state) ---- * divertDIVPORT * fwdIP[PORT] * nat# * pipe# * queue# |
* check-state (+первое правило с keep-state/limit) |
Строка 19: | Строка 13: |
* teeDIVPORT * netgraphCOOKIE, ngteeCOOKIE |
* divert DIVPORT, tee DIVPORT * fwd IP [PORT] * pipe#, qeue# * reass |
Строка 22: | Строка 18: |
* setdscpDSCP * reass |
* Прочее: nat#, netgraph COOKIE, ngtee COOKIE |
Строка 34: | Строка 29: |
* bridged layer2 * mac(dst-mac,any src-mac,any) mac-typeTYPE * icmptypesTYPES * protoPROTO * in out * {recv|xmit|via}IFACE * ipidLIST iplenLIST ipoptionsSPEC ipprecedencePREC ipsec iptosSPEC ipttlLIST ipversionVER * frag * dscpSPECS * diverted diverted-loopback diverted-output * dst-ipIP dst-portPORTS src-ipADDRS src-portPORTS * keep-state limit{src-addr|src-port|dst-addr|dst-port}# * tcpackACK tcpdatalenLIST tcpflagsSPEC tcpseqSEQ tcpwinLIST tcpoptionsSPEC established (RST|ACK), setup (tcpflags syn,!ack) * taggedLIST * gidGID, uidUID * fib# * jail# * lookup {dst-ip|dst-port|src-ip|src-port|uid|jail}# * verrevpath versrcreach antispoof |
|
Строка 35: | Строка 49: |
bridged layer2 diverted diverted-loopback diverted-output dst-ipIP dst-portPORTS established fib# frag gidGID jail# icmptypesTYPES in out ipidLIST iplenLIST ipoptionsSPEC ipprecedencePREC ipsec iptosSPEC dscpSPECS ipttlLIST ipversionVER keep-state limit{src-addr|src-port|dst-addr|dst-port}# lookup {dst-ip|dst-port|src-ip|src-port|uid|jail}# mac(dst-mac,any src-mac,any) mac-typeTYPE protoPROTO {recv|xmit|via}IFACE setup sockarg src-ipADDRS src-portPORTS taggedLIST tcpackACK tcpdatalenLIST tcpflagsSPEC tcpseqSEQ tcpwinLIST tcpoptionsSPEC uidUID verrevpath versrcreach antispoof | '''LOOKUP TABLES''' — аналог таблиц маршрутизации (+/MASK), но +порт,jail#,IP и ifacename |
Строка 37: | Строка 51: |
LOOKUP TABLES — аналог таблиц маршрутизации (+/MASK), но +порт,jail#,IP и ifacename | |
Строка 39: | Строка 52: |
SETS OF RULES 0-31 (неубиваемый), нумерация правил общая, enable/disable/flush, move, swap | '''SETS OF RULES''' — 0-31 (неубиваемый), нумерация правил общая, enable/disable/flush, move, swap |
Строка 41: | Строка 54: |
STATEFUL FIREWALL | '''STATEFUL FIREWALL''' |
Строка 51: | Строка 64: |
DIVERT SOCKET: просто [[BSDman2:bind]] | '''DIVERT SOCKET''': * [[BSDman4:divert]] * просто [[BSDman2:bind|bind(2)]] * Пример: [[BSDman:natd|natd]] |
Строка 53: | Строка 69: |
'''DUMMYNET''' * pipe, queue, sched * pipe # config …: * bw bandwidth|iface * delay ms-delay * burst size (если труба была пустая, пускать больше) * profile filename (сложный профиль) * buckets hash-table-size * mask mask-specifier * noerror * plr packet-loss-rate * queue {slots | sizeKbytes} * red | gred параметры |
|
Строка 54: | Строка 83: |
---- log dummynet divert |
'''LOG''': * syslog (`net.inet.ip.fw.verbose=1`) * `fconfig ipfw0 create` ⇒ … |
Использование IPFW
Общий вид правила:
[rule_number] [set set_number] [prob match_probability] action [log [logamount number]] [altq queue] [{tag | untag} number] body
action:
- allow, deny, unreach ICMPTYPE, reset; count
- check-state (+первое правило с keep-state/limit)
- skipto#, call# / return
- divert DIVPORT, tee DIVPORT
- fwd IP [PORT]
- pipe#, qeue#
- reass
- setfib#
- Прочее: nat#, netgraph COOKIE, ngtee COOKIE
body: [proto from src to dst] [options]
proto (/etc/protocols), all
src,dst: any | me | table# | addr(+/mask) addrlist [ports]
ports: port,port-port[ports]
OPTIONS
- bridged layer2
- mac(dst-mac,any src-mac,any) mac-typeTYPE
- icmptypesTYPES
- protoPROTO
- in out
- {recv|xmit|via}IFACE
- ipidLIST iplenLIST ipoptionsSPEC ipprecedencePREC ipsec iptosSPEC ipttlLIST ipversionVER
- frag
- dscpSPECS
- diverted diverted-loopback diverted-output
- dst-ipIP dst-portPORTS src-ipADDRS src-portPORTS
- keep-state limit{src-addr|src-port|dst-addr|dst-port}#
- tcpackACK tcpdatalenLIST tcpflagsSPEC tcpseqSEQ tcpwinLIST tcpoptionsSPEC established (RST|ACK), setup (tcpflags syn,!ack)
- taggedLIST
- gidGID, uidUID
- fib#
- jail#
- lookup {dst-ip|dst-port|src-ip|src-port|uid|jail}#
- verrevpath versrcreach antispoof
LOOKUP TABLES — аналог таблиц маршрутизации (+/MASK), но +порт,jail#,IP и ifacename
SETS OF RULES — 0-31 (неубиваемый), нумерация правил общая, enable/disable/flush, move, swap
STATEFUL FIREWALL
ipfw add check-state ipfw add allow tcp from my-subnet to any setup keep-state ipfw add deny tcp from any to any
Dynamic rules are created when a packet matches a keep-state or limit rule
ipfw -d -e show
DIVERT SOCKET:
DUMMYNET
- pipe, queue, sched
- pipe # config …:
- bw bandwidth|iface
- delay ms-delay
- burst size (если труба была пустая, пускать больше)
- profile filename (сложный профиль)
- buckets hash-table-size
- mask mask-specifier
- noerror
- plr packet-loss-rate
- queue {slots | sizeKbytes}
- red | gred параметры
LOG:
syslog (net.inet.ip.fw.verbose=1)
fconfig ipfw0 create ⇒ …
Пример
Разбор группы правил из FreeBSD handbook.