Вот мё:
Код: Выделить всё
[voy@bsd:~]$ ifconfig rl0
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 00:40:45:20:b2:cf
inet 178.140.187.130 netmask 0xffffff00 broadcast 178.140.187.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
[voy@bsd:~]$ ifconfig re0
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
ether 00:e0:4c:00:19:20
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
inet 192.168.2.2 netmask 0xffffff00 broadcast 192.168.2.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
Код: Выделить всё
[voy@bsd:~]$ cat /etc/firewall2.sh
ipfw -f flush
ipfw -f pipe flush
ipfw -f queue flush
# разрешаем все через интерфейс локальной сети
ipfw add 1040 allow ip from any to any via re0
# настройка ната.
ipfw nat 1 config log if rl0 reset same_ports deny_in
# заварачиваем все что проходит через внешний интерфейс в нат
ipfw add 10300 nat 1 ip from any to any via rl0
ipfw add 65534 deny all from any to any
Код: Выделить всё
[root@bsd:/etc]# cat firewall3.sh
ipfw -f flush
ipfw -f pipe flush
ipfw -f queue flush
# разрешаем все через интерфейс локальной сети
ipfw add 1040 allow ip from any to any via re0
ipfw pipe 1 config bw 500Kbit/s queue 60 gred 0.002/10/30/0.1
ipfw queue 1 config pipe 1 queue 60 mask src-ip 0xffffffff gred 0.002/10/30/0.1
ipfw pipe 2 config bw 250Kbit/s queue 60 gred 0.002/10/30/0.1
ipfw queue 2 config pipe 2 queue 60 mask dst-ip 0xffffffff gred 0.002/10/30/0.1
ipfw nat 1 config log if rl0 reset same_ports deny_in
ipfw add 10150 queue 1 ip from any to any out xmit rl0
ipfw add 10160 nat 1 ip from any to any via rl0
ipfw add 10170 queue 2 ip from any to any in recv rl0
ipfw add 10230 allow all from any to any
ipfw add 65534 deny all from any to any
Код: Выделить всё
[root@bsd:~]# /etc/firewall3.sh
Flushed all rules.
Flushed all pipes.
Flushed all pipes.
01040 allow ip from any to any via re0
ipfw nat 1 config if rl0 log deny_in same_ports reset
10150 queue 1 ip from any to any out xmit rl0
10160 nat 1 ip from any to any via rl0
10170 queue 2 ip from any to any in recv rl0
10230 allow ip from any to any
65534 deny ip from any to any
Код: Выделить всё
[root@bsd:~]# ipfw list
01040 allow ip from any to any via re0
10150 queue 1 ip from any to any out xmit rl0
10160 nat 1 ip from any to any via rl0
10170 queue 2 ip from any to any in recv rl0
10230 allow ip from any to any
65534 deny ip from any to any
65535 deny ip from any to any
Код: Выделить всё
[root@bsd:~]# ipfw pipe show
00001: 500.000 Kbit/s 0 ms 60 sl. 0 queues (1 buckets)
GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
burst: 0 Byte
00002: 250.000 Kbit/s 0 ms 60 sl. 0 queues (1 buckets)
GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
burst: 0 Byte
q00001: weight 1 pipe 1 60 sl. 3 queues (64 buckets)
GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
mask: 0x00 0xffffffff/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
20 ip 192.168.2.30/0 0.0.0.0/0 3387 310860 0 0 0
24 ip 178.140.187.130/0 0.0.0.0/0 1807 1420406 0 0 0
40 ip 192.168.2.32/0 0.0.0.0/0 383 22211 0 0 0
q00002: weight 1 pipe 2 60 sl. 0 queues (64 buckets)
GRED w_q 0.001999 min_th 10 max_th 30 max_p 0.099991
Прошу помощи!