用iptables封殺內(nèi)網(wǎng)的bt軟件
我所在的網(wǎng)絡(luò)情況是這樣的!1臺FC3和3臺win2000組成一個局域網(wǎng)!四臺機(jī)都接在100m的交換機(jī)上.在FC3上有兩個網(wǎng)卡eth0接外網(wǎng) adsl eth1接在交換機(jī).FC3做nat帶3臺win2000上網(wǎng)!由于ADSL的帶寬本來就慢如果內(nèi)網(wǎng)有人用BT的話那就更慢啦!所有找了一下資料!決定封殺內(nèi)網(wǎng)的bt軟件!
用到cvs版本的iptables在ftp://ftp.netfilter.org/pub/iptables/snapshot/有下載 還要iptables的擴(kuò)展包
patch-o-matic-ng在ftp://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/ 也有下載.
把patch-o-matic-ng-20041231.tar.bz2和 iptables-1.3.0-20041231.tar.bz2 拷貝到/usr/local/src目錄下
首先先卸載了系統(tǒng)原先的iptables軟件包
rpm -qa |grep iptables
rpm -e --nodeps iptables-devel
rpm -e --nodeps iptables
為了安裝方便用 root用戶登錄
然后
tar -jxvf iptables-1.3.0-20041231.tar.bz2
tar -jxvf patch-o-matic-ng-20041231.tar.bz2
cd patch-o-matic-ng-20041231
./runme extra
輸入你內(nèi)核源代碼的路徑/usr/src/linux-2.6.10
輸入你iptables源代碼的路徑/usr/local/src/iptables-1.3.0-20041231
然后按你自己的需要把iptables的擴(kuò)展補(bǔ)丁打到內(nèi)核(要實(shí)現(xiàn)封殺bt一定要選上ipp2p這擴(kuò)展)
cd /usr/src/linux-2.6.10
make xconfig
把networking support-->networking options-->networking packet filtering-->IP:netfilter configruation-->ipp2p match選上
make
make modules_install
make install
新得帶有ipp2p模塊的新內(nèi)核就安裝好了
現(xiàn)在iptables有安裝
cd /usr/local/src/iptables-1.3.0-20041231
make KERNEL_DIR=/usr/src/linux-2.6.10
make install KERNEL_DIR=/usr/src/linux-2.6.10
make install-devel
reboot
重啟后選新內(nèi)核進(jìn)入系統(tǒng),如果你的系統(tǒng)內(nèi)核選了自動掛載模塊功能就直接用下面的命令就可以灃鎖p2p軟件啦
用iptables -A FORWARD -p tcp -m ipp2p --ipp2p --bit --apple--winmx --soul -j DROP
如果你的系統(tǒng)內(nèi)核沒有選自動掛載模塊功能你要先
modprobe ipt_ipp2p
要更精細(xì)的控制請查看ipp2p模塊的文檔和iptables的文檔
經(jīng)測試內(nèi)網(wǎng)的bitcomet 和emule等軟件都不能下載和上傳!