前言
FreeBSD Gateway可以利用ipfw來達成流量限制的功能,想要使用這個除了/etc/rc.conf需要設定以外,還需要讓kernel的dummynet啟動才會正常啟動
Dummynet
動態載入
由於現在都是使用Generic的Kernel(減少compile Kernel的動作)所以使用kldload來load dummynet.ko
手動載入
1 | kldload dummynet |
想要確認有沒有跑起來請用
1 | kldstat |
這個指令會列出所有動態載入的.ko
開機自動載入
1 | # /boot/loader.conf |
之後重開機的時候就會自動載入了
ipfw
/etc/rc.conf
1 | firewall_enable="YES" |
上述設定的意思就是啟動ipfw,設定檔為/etc/ipfw.conf,並且不啟動natd
/etc/ipfw.conf
1 | #定義介面 |
這個規則基本上依照ipfw add 後的數字定義優先權數字越少的規則優先權越高