安装教程:pppoe服务器+qos
想玩Pppoe-Server的同学们注意了!!!要想成功运行,就必须做到以下步骤!该功能需要具备以下安装包:ppp 2.4.4-13
ppp-mod-pppoe 2.4.4-13
rp-pppoe-server 3.10-1以下是配置文件内容:
1. /etc/ppp/pppoe-server-opton
# PPP options for the PPPoE server
# LIC: GPL
#login
logfile /var/log/pppoed.log
require-chap
mru 1480
mtu 1480
default-asyncmap
proxyarp
noktune
login
lcp-echo-interval 20
lcp-echo-failure 2
ms-dns 202.98.192.67
nobsdcomp
noccp
noendpoint
noipdefault
novj
receive-all
2. /etc/ppp/chap-secrets
#USERNAMEPROVIDERPASSWORDIPADDRESS
pppop * pppoe *
tqz * tqz 10.0.1.2
3. /etc/init.d/pppoe-server
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
DEFAULT=/etc/default/pppoe-server
start() {
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -j MASQUERADE
/usr/sbin/pppoe-server -k -T 60 -I br-lan -N 100 -L 10.0.1.1 -R 10.0.1.2
}
stop() {
killall pppoe-server
}
4. /etc/firewall.user
# iptables -I INPUT -j ACCEPT
# iptables -I OUTPUT -j ACCEPT
5.QOS限速实现
#!/bin/bash
for ((i = 1; i < 253; i++))
# 这里给一个变量,是对于网内一个IP地址段做限速
do
/sbin/iptables -A FORWARD -s 10.0.1.$i -m limit -limit 60/s -j ACCEPT
/sbin/iptables -A FORWARD -s 10.0.1.$i -j DROP
done
当流量小于60/s的时候,iptables 接受并转发。当流量大于60/s 的时候,iptables丢弃数据包。
for((i=2;i<255;i++));do
iptables -A FORWARD -s 10.0.1.$i -m limit --limit 20/s -j ACCEPT
iptables -A FORWARD -s 10.0.1.$i DROP
done
添加:
iptables -A FORWARD -s 10.0.1.2-m limit --limit 20/s -j ACCEPT
iptables -A FORWARD -s 10.0.1.2 -j DROP
删除:
iptables -D FORWARD -s 10.0.1.1 -m limit --limit 20/s -j ACCEPT
iptables -D FORWARD -s 10.0.1.1 -j DROP
可以不配置4.因为是注释符号在前,不影响。如果去掉。不拨号也能上网,这是一个转发机制。你们要想用我的上网,必须宽带拨号,不然休想!!!
页:
[1]