сам скрипт
Код: Выделить всё
#!/bin/sh
ipfw="/sbin/ipfw"
${ipfw} -q flush
${ipfw} -q pipe flush
${ipfw} -q queue flush
${ipfw} add divert natd all from any to any via vr0
${ipfw} add pipe 2 all from 172.16.7.5 to any out via vr0
${ipfw} pipe 2 config bw 100kbit/s queue 512kbit/s
${ipfw} add pipe 1 all from any to 172.16.7.5 in via vr0
${ipfw} pipe 1 config bw 1024kbit/s queue 512kbit/s
Система:
Код: Выделить всё
uname -a
FreeBSD gemini.local 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Wed Aug 4 23:49:26 EEST 2010 uxn@gemini.local:/usr/obj/usr/src/sys/ROUTE i386
Код: Выделить всё
gemini# sysctl net. | grep dummynet
net.inet.ip.dummynet.io_pkt_drop: 111
net.inet.ip.dummynet.io_pkt_fast: 18345
net.inet.ip.dummynet.io_pkt: 81658
net.inet.ip.dummynet.queue_count: 0
net.inet.ip.dummynet.fsk_count: 2
net.inet.ip.dummynet.si_count: 0
net.inet.ip.dummynet.schk_count: 4
net.inet.ip.dummynet.tick_lost: 0
net.inet.ip.dummynet.tick_diff: -3106
net.inet.ip.dummynet.tick_adjustment: 3117
net.inet.ip.dummynet.tick_delta_sum: -85
net.inet.ip.dummynet.tick_delta: -11
net.inet.ip.dummynet.red_max_pkt_size: 1500
net.inet.ip.dummynet.red_avg_pkt_size: 512
net.inet.ip.dummynet.red_lookup_depth: 256
net.inet.ip.dummynet.expire_cycle: 0
net.inet.ip.dummynet.expire: 1
net.inet.ip.dummynet.debug: 0
net.inet.ip.dummynet.io_fast: 0
net.inet.ip.dummynet.pipe_byte_limit: 1048576
net.inet.ip.dummynet.pipe_slot_limit: 100
net.inet.ip.dummynet.hash_size: 64
Код: Выделить всё
gemini# ipfw show
00100 702 522432 divert 8668 ip from any to any via vr0
00200 0 0 pipe 2 ip from 172.16.7.5 to any out via vr0
00300 352 408387 pipe 1 ip from any to 172.16.7.5 in via vr0
65535 332000 269861754 allow ip from any to any
Код: Выделить всё
gemini# ipfw pipe show
00001: 1.024 Mbit/s 0 ms burst 0
q131073 512 KB 0 flows (1 buckets) sched 65537 weight 0 lmax 0 pri 0 droptail
sched 65537 type FIFO flags 0x0 0 buckets 0 active
00002: 100.000 Kbit/s 0 ms burst 0
q131074 512 KB 0 flows (1 buckets) sched 65538 weight 0 lmax 0 pri 0 droptail
sched 65538 type FIFO flags 0x0 0 buckets 0 active