| FreeBSD IPFW Kullanım Kılavuzu | ||
|---|---|---|
| Önceki | Bölüm 5. Örneklerle IPFW | |
Kompleks bir firewall örneği ele alalım. 2 ayrı internet bağlantısına sahip, 4 farklı fiziksel networke doğrudan bağlı bir güvenlik duvarı tasarımı yapacağız.
___________
LAN1 <--> bge0 | |
LAN2 <--> bge1 | | em0 <--> 2Mbit Frame Relay
LAN3 <--> bge2 | FreeBSD | em1 <--> 2Mbit ADSL
LAN4 <--> bge3 | |
-----------
LAN1 - 192.168.1.0/24, LAN2 - 192.168.2.0/24, LAN3 - 192.168.3.0/24, LAN4 - 192.168.4.0/24 network adresleri ile çalışıyor olsunlar. Frame Relay Networku 1.1.1.0/29 olsun, FrameRelay Router'i ise 1.1.1.1 olsun. ADSL'e PPPoE ile bağlanalım ve servis sağlayıcıdan aldığımız IP adresi 2.2.2.2/32 olsun.
---- /etc/ngnat.sh ---- #!/bin/sh kldload ng_ipfw kldload ng_nat ngctl mkpeer ipfw: nat 100 out ngctl name ipfw:100 framerelay ngctl connect ipfw: framerelay: 110 in ngctl msg framerelay: setaliasaddr 1.1.1.2 ngctl mkpeer ipfw: nat 200 out ngctl name ipfw:200 framerelay ngctl connect ipfw: framerelay: 210 in ngctl msg framerelay: setaliasaddr 2.2.2.2 ----------------------- ---- /etc/ipfw.conf ---- -f flush table 1 flush table 1 add 192.168.1.0/24 // LAN1 table 1 add 192.168.2.0/24 // LAN2 table 1 add 192.168.3.0/24 // LAN3 table 1 add 192.168.4.0/24 // LAN4 add allow ip from any to any via lo0 add deny ip from any to 127.0.0.0/8 add deny ip from any to any not versrcreach in via bge0 add deny ip from any to any not versrcreach in via bge1 add deny ip from any to any not versrcreach in via bge2 add deny ip from any to any not versrcreach in via bge3 add fwd 1.1.1.1 ip from 1.1.1.0/29 to any add fwd localhost,3128 tcp from not me to any 80 add allow tcp from any to me 22 keep-state add prob 0.5 netgraph 100 tcp from table(1) to any 25,80,110,443 add netgraph 200 tcp from table(1) to any 25,80,110,443 add prob 0.5 netgraph 100 udp from table(1) to any 53 add netgraph 200 udp from table(1) to any 53 add netgraph 110 ip from any to me via em0 add netgraph 210 ip from any to me via em1 add allow ip from me to any via em1 add deny ip from any to any ------------------------
Uyarı 1.1.1.2 Nolu IP Adresini em0'a ve 2.2.2.2 nolu IP Adresini em1'e atamayı unutmayın. Aksi halde natlanan paketler geri dönemeyecektir.