Are you sure you want to put in eth1 there? As far as I remember the interfaces have been moved around on the new WL500. Try to look at earlier post regarding this.
BR,
René
Printable View
Ups, I've already solved it :D Wshaper was working all the time on the WL-500gP, but I asked the wrong interface for status! The right WAN interface is in my case vlan1, I got it out by using ifconfig. Don't panic... :)
BR
Robert
What would be the best way to limit 1 internal IP but keep the speed for the internal net?
# 192.168.0.9 should get an up/down like 10k/50k to the external net
# internal net - 192.168.0.x transfers (also to 192.168.0.9) have to run on 100MBit
# all other hosts will still run on defaults
edit the /sbin/wshaper or in the post-firewall?
running on WL500g default config
network changed to 192.168.0.x
Thanks in advance!
Mike
Hi Mike,
you cannot edit /sbin/wshaper, that part of the FS is read only. You should copy the wshaper "template" from /sbin/ to /usr/local/sbin and edit it there.
Theoretically you need a filter rule in the wshaper like that:
tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
match ip src 192.168.0.9 \
flowid 1:30
But I am afraid that it will not work correctly. Alternatively you can try to use iptables for marking the pakets from 192.168.0.9.
Regards
Robert
I've started using wshaper and it works very well.
I have "only" one problem with it.
I don't know, really don't know how can I prioritize not only one, but a range of ports. I've searched by google, but only saw examples that really not do the same (as I see).
So, if I try (for example) to get FTP transfers work and I want to prioritize ports 1024-5000 (the ports 20 and 21 are already prioritized), what I have to do?
I tried:
andCode:tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip sport 1024 0xf077 flowid 1:21
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip dport 1024 0xf077 flowid 1:21
But it seems they don't working.Code:tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip sport 1024 0xf88 flowid 1:21
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip dport 1024 0xf88 flowid 1:21
The FTP client tried to connect on port 3xxx.
Please, somebody tell me how can I use that mask to get working.
I spent very much time on searching but I don't know what would I have to do.
Please, someone write me the method.
I'm not as stupid as it seems...
Just an example for masking:
1024 0xfc00 will prioritize a range of 1024... 2047
2048 0xf800 will prioritize a range of 2048... 4095
4096 0xfc00 will prioritize a range of 4096... 5119
If a mask bit is zero, then the corresponding port bit is "don't care" for filtering.
Regards
Robert
Thank you your answer.
Hmm...
Then I think
1024 0xf077 will prioritize a range of ports 1024...5000
...as it was in my first try. Is it O.K.?
...but I don't know why didn't it work.
I tried again but it seems still not working.
I think I will work on it yesterday.
I hope I am not too far from the solution...
Definitely not! Let me explain:
1024 = 0x400, so we have
port 0x0400
mask 0xf077
or in binary
port 0000.0100.0000.0000
mask 1111.0000.0111.0111
===> 0000.xxxx.x000.x000 will match the rule (x = "don't care")
now let me demonstrate you a couple of ports matching your rule:
0000.0000.0000.0000 = 0x0
0000.0000.0000.1000 = 0x8
0000.0000.1000.1000 = 0x88 = 136
and the largest one is:
0000.1111.1000.1000 = 0xf88 = 3976
Do you undestand?
Regards
Robert
This is more complicated than I thought. :-(
You said:
1024 0xfc00 will prioritize a range of 1024... 2047
so:
0000 0100 0000 00000000 0011 1111 1111 is a max port of 1023
1111 1100 0000 0000
0000 00xx xxxx xxxx
Is that for ports 1024 to (1024+1023=2047)?
2048 0xf800 will prioritize a range of 2048... 4095
so:
0000 1000 0000 00000000 0111 1111 1111 is a max port of 2047
1111 1000 0000 0000
0000 0xxx xxxx xxxx
Is that for ports 2048 to (2048+2047=4095)?
4096 0xfc00 will prioritize a range of 4096... 5119
0001 0000 0000 00000000 0011 1111 1111 is a max port of 1023
1111 1100 0000 0000
0000 00xx xxxx xxxx
Is that for ports 2048 to (4096+1023=5119)?
I tried:
1024 0xf000 (ports 1024 to 5119?)
so:
0000 0100 0000 0000
1111 0000 0000 0000
0000 xxxx xxxx xxxx
I'm don't understand how is the port range depends on the specified port number.
I think :) my mask is from 0 to 4095.
How is the lower '1024' ports limit working?
Is the 1024 to (4095+1024=5119) formula ok?
I hope you have enough patiente for me...
I said, if the mask bit is zero, the port bit is "don't care"
1024 0xfc00 will prioritize a range of 1024... 2047, so:
port 0000 0100 0000 0000
mask 1111 1100 0000 0000
===> 0000 01xx xxxx xxxx
so the min. range is
0000 0100 0000 0000 = 0x400 = 1024
the max. range is
0000 0111 1111 1111 = 0x7ff = 2047
you have made the same error in all three examples!
That doesn't make sense! You have masked the '1' of 1024 out, so the min. range cannot be 1024. And you are right, it's really zero.Quote:
I tried:
1024 0xf000 (ports 1024 to 5119?)
so:
0000 0100 0000 0000
1111 0000 0000 0000
0000 xxxx xxxx xxxx
What I tried to explain you, you cannot define a range of 1024... 5000 in only one rule by using masking. You will need a couple of rules, to do it exactly. But you can go the "lazy way" and define a range of 1024... 5119 with only three rules ;)
Regards
Robert
P.S.: Did you already read http://lartc.org/howto/ ? Maybe there is a syntactic way to define a "real" port range like "from <min. port> to <max. port>"...
Hello!
I'm using wonder shaper script, but I have 2 problems.
1. whaper script doesn't start automatically
2. all traffic goes to default class 1:30
I 've costumized it for myself. Template was Akbor's script.
So, my steps were
1. mkdir -p /usr/local/sbin
2. "copy wshaper to /usr/local/sbin and edit it"
3. touch /usr/local/sbin/post-firewall
4. chmod +x /usr/local/sbin/post-firewall
5. "edit post-firewall"
6. flashfs save
7. flashfs commit
8. flashfs enable
9. reboot
post-firewall script
#!/bin/sh
/usr/local/sbin/wshaper start "$1" 1000 230
But when I type /usr/local/sbin/wshaper status eth1 nothing is happend.
If I start wshaper manually /usr/local/sbin/wshaper start "eth1" 1000 230 wshaper starts, but there is another problem: all traffic goes to class 1:30, which is my default class. If I send ping or if I'm browsing there is still no traffic in class 1:10 or 1:20 (I look sent and lended; is this rigth? both numbers are zero) . I tried to change my default class to 1:20 and then all traffic goes there, so some part of my script is working.
I don't know what I'm doing wrong.
I've read all links about wshaper, discussion about wshaper and still cannot figure what is wrong.
Dont' look numbers for speed, I'll play later with them, when everything else will work fine.
So, I have WL500g with Oleg's FW 1.9.2.7-6b. Connection is ADSL 1Mbit/256Kbit.
I turned off bandwith managment in web interface and delete all rules.
My wshaper script:
Please, help me to figure out what I'm doing wrong.PHP Code:#!/bin/sh
# Wonder Shaper, last modified by Doc
#
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits. Also set the device that is to be shaped.
DOWNLINK=$3
UPLINK=$4
DEV=$2
# low priority OUTGOING traffic - you can leave this blank if you want
# low priority source netmasks
NOPRIOHOSTSRC="$5"
# low priority destination netmasks
NOPRIOHOSTDST="$6"
# low priority source ports
NOPRIOPORTSRC="$7"
# low priority destination ports
NOPRIOPORTDST="$8"
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi
# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
if [ "$1" = "stop" ]
then
exit
fi
########## uplink ##########
# install root HTB, point default traffic to 1:30:
tc qdisc add dev $DEV root handle 1: htb default 30
# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit \
ceil ${UPLINK}kbit burst 6k
# high prio class 1:10 - gets 50 to 100% traffic and highest priority:
tc class add dev $DEV parent 1:1 classid 1:10 htb rate $((5*$UPLINK/10))kbit \
ceil ${UPLINK}kbit burst 6k prio 1
# normal class 1:20 - gets 40 to 100% traffic and lower priority:
tc class add dev $DEV parent 1:1 classid 1:20 htb rate $((4*$UPLINK/10))kbit \
ceil ${UPLINK}kbit burst 6k prio 2
# lowest priority class (bulk) 1:30 - gets 10 to 100% traffic and lowest priority:
tc class add dev $DEV parent 1:1 classid 1:30 htb rate $((1*$UPLINK/10))kbit \
ceil ${UPLINK}kbit burst 6k prio 3
# all get Stochastic Fairness:
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add dev $DEV parent 1:0 protocol ip prio 2 u32 \
match ip tos 0x10 0xff \
flowid 1:10
# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:10\
match ip protocol 1 0xff \
flowid 1:10
# Browsing
tc filter add dev $DEV parent 1: protocol ip prio 2 u32 \
match ip sport 80 0xffff \
flowid 1:20
tc filter add dev $DEV parent 1: protocol ip prio 2 u32 \
match ip dport 80 0xffff \
flowid 1:20
tc filter add dev $DEV parent 1: protocol ip prio 2 u32 \
match ip sport 430 0xffff \
flowid 1:20
tc filter add dev $DEV parent 1: protocol ip prio 2 u32 \
match ip dport 430 0xffff \
flowid 1:20
# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev $DEV parent 1: protocol ip prio 4 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10
# some traffic however suffers a worse fate
for a in $NOPRIOPORTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
match ip dport $a 0xffff flowid 1:30
done
for a in $NOPRIOPORTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
match ip sport $a 0xffff flowid 1:30
done
for a in $NOPRIOHOSTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
match ip src $a flowid 1:30
done
for a in $NOPRIOHOSTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
match ip dst $a flowid 1:30
done
# rest is 'non-interactive' ie 'bulk' and ends up in 1:20
#tc filter add dev $DEV parent 1: protocol ip prio 1 u32 \
# match ip dst 0.0.0.0/0 flowid 1:20
########## downlink ##########
# slow downloads down to somewhat less than the real speed to prevent
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:
tc qdisc add dev $DEV handle ffff: ingress
# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:
tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
Thank you in advance.
PS: I noticed that there are no backslashes (\) in my posted script where they should be, but I have them in my "real" script.
@dholliday
Maybe you should usefor asking the status? Which interface is used for WAN, "eth1" or "ppp0"? Use "ifconfig" to find it out.Code:wshaper status ppp0
Regards
Robert
Akbor,
thank you for your reply.
Yes, it looks like that wan interface is ppp0. Everyone were talking about eth1 and I wasn't thinking too much.
So wshaper is working on ppp0 and rules for classes are also working properly. Now I have to test it well.
But I still don't know which line at ifconfig interfaces tell you, which interface is wan.:confused:
I also triedCode:br0 Link encap:Ethernet HWaddr 00:11:1A:D3:G7:9A
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::121:2fff:fde9:a23f/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:332389 errors:0 dropped:0 overruns:0 frame:0
TX packets:279712 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:138723300 (132.2 MiB) TX bytes:182985245 (174.5 MiB)
eth0 Link encap:Ethernet HWaddr 00:11:1A:D3:G7:9A
inet6 addr: fe80::121:2fff:fde9:a23f/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:316202 errors:0 dropped:0 overruns:0 frame:0
TX packets:270799 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:138343464 (131.9 MiB) TX bytes:177984779 (169.7 MiB)
Interrupt:3 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:11:1A:D3:G7:9A
inet6 addr: fe80::121:2fff:fde9:a23f/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:252696 errors:0 dropped:0 overruns:0 frame:0
TX packets:279040 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:177370024 (169.1 MiB) TX bytes:135983232 (129.6 MiB)
Interrupt:4 Base address:0x8000
eth2 Link encap:Ethernet HWaddr 00:11:1A:D3:G7:9A
inet6 addr: fe80::121:2fff:fde9:a23f/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17767 errors:0 dropped:0 overruns:0 frame:529
TX packets:103078 errors:194 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:6456856 (6.1 MiB) TX bytes:15657176 (14.9 MiB)
Interrupt:6 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:14144 errors:0 dropped:0 overruns:0 frame:0
TX packets:14144 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1200947 (1.1 MiB) TX bytes:1200947 (1.1 MiB)
ppp0 Link encap:Point-Point Protocol
inet addr:195.210.243.164 P-t-P:213.250.18.90 Mask:255.255.255.255
UP POINTOPOINT RUNNING MULTICAST MTU:1492 Metric:1
RX packets:251513 errors:0 dropped:0 overruns:0 frame:0
TX packets:277856 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:170756422 (162.8 MiB) TX bytes:129834799 (123.8 MiB)
wds0.4915 Link encap:Ethernet HWaddr 00:11:1A:D3:G7:9A
inet6 addr: fe80::121:2fff:fde9:a23f/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
and get this:Code:nvram show |grep "ifname"
and didn't find out which line is saying, that wan is ppp0, because there are many "wan" lines. :confused:Code:printer_ifname=usb
wan0_ifname=eth1
wl0_ifname=eth2
wan0_pppoe_ifname=ppp0
lan_ifnames_t=eth0 eth2 eth3 eth4
lan_ifnames=eth0 eth2 eth3 eth4
wan_ifnames=eth1
size: 10683 bytes (22085 left)
lan_ifname=br0
wan_ifname_t=ppp0
wl_ifname=
wan_ifname=eth1
wan0_ifnames=eth1
wan_pppoe_ifname=
I also looked in log file:
In last case one line is saying Using interface ppp0. OK, this could I undestand if line is really talking about wan, but I'm not sure. What is then eth1 interface? :confused: :confused: :confused:Code:Jan 1 01:00:04 kernel: Algorithmics/MIPS FPU Emulator v1.5
Jan 1 01:00:04 kernel: eth0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.7.0
Jan 1 01:00:04 kernel: eth1: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.7.0
Jan 1 01:00:04 kernel: PCI: Enabling device 01:02.0 (0004 -> 0006)
Jan 1 01:00:04 kernel: eth2: Broadcom BCM4320 802.11 Wireless Controller 3.90.23.0
Jan 1 01:00:04 kernel: device eth0 entered promiscuous mode
Jan 1 01:00:04 kernel: device eth2 entered promiscuous mode
Jan 1 01:00:04 kernel: device wds0.49153 entered promiscuous mode
Jan 1 01:00:04 kernel: br0: port 3(wds0.49153) entering listening state
Jan 1 01:00:04 kernel: br0: port 2(eth2) entering listening state
Jan 1 01:00:04 kernel: br0: port 1(eth0) entering listening state
Jan 1 01:00:04 kernel: br0: port 3(wds0.49153) entering learning state
Jan 1 01:00:04 kernel: br0: port 2(eth2) entering learning state
Jan 1 01:00:04 kernel: br0: port 1(eth0) entering learning state
Jan 1 01:00:04 kernel: br0: port 3(wds0.49153) entering forwarding state
Jan 1 01:00:04 kernel: br0: topology change detected, propagating
Jan 1 01:00:04 kernel: br0: port 2(eth2) entering forwarding state
Jan 1 01:00:04 kernel: br0: topology change detected, propagating
Jan 1 01:00:04 kernel: br0: port 1(eth0) entering forwarding state
Jan 1 01:00:04 kernel: br0: topology change detected, propagating
Jan 1 01:00:05 kernel: usb.c: registered new driver usbdevfs
Jan 1 01:00:05 kernel: usb.c: registered new driver hub
Jan 1 01:00:05 kernel: usb-ohci.c: USB OHCI at membase 0xb8004000, IRQ 2
Jan 1 01:00:05 kernel: usb-ohci.c: usb-00:05.0, PCI device 13e4:4815
Jan 1 01:00:05 kernel: usb.c: new USB bus registered, assigned bus number 1
Jan 1 01:00:05 kernel: hub.c: USB hub found
Jan 1 01:00:05 kernel: hub.c: 2 ports detected
Jan 1 01:00:06 kernel: lp0: using parport0 (polling).
Jan 1 01:00:06 kernel: usb.c: registered new driver usblp
Jan 1 01:00:06 kernel: printer.c: v0.13: USB Printer Device Class driver
Jan 1 01:00:08 kernel: usb.c: registered new driver audio
Jan 1 01:00:08 kernel: audio.c: v1.0.0:USB Audio Class driver
Jan 1 01:00:09 kernel: Linux video capture interface: v1.00
Jan 1 01:00:09 kernel: SCSI subsystem driver Revision: 1.00
Jan 1 01:00:10 kernel: Initializing USB Mass Storage driver...
Jan 1 01:00:10 kernel: usb.c: registered new driver usb-storage
Jan 1 01:00:10 kernel: USB Mass Storage support registered.
Jan 1 01:00:11 pppd[83]: Plugin rp-pppoe.so loaded.
Jan 1 01:00:11 pppd[83]: RP-PPPoE plugin version 3.3 compiled against pppd 2.4.2
Jan 1 01:00:11 pppd[84]: pppd 2.4.2 started by fbjklstm, uid 0
Jan 1 01:00:11 kernel: lp driver: get device ID
Jan 1 01:00:11 kernel: neg fail
Jan 1 01:00:17 kernel: lp driver: get device ID
Jan 1 01:00:17 kernel: neg fail
Jan 1 01:00:17 kernel: neg fail
Jan 1 01:00:26 pppd[84]: PPP session is 5092
Jan 1 01:00:26 pppd[84]: Using interface ppp0
Jan 1 01:00:26 pppd[84]: Connect: ppp0 <--> eth1
Jan 1 01:00:27 pppd[84]: CHAP authentication succeeded
Sorry on my quite stupid questions, but I'm a noob in this and would like to understand some things, not just take it as a fact.
Thank you again for ansvers.
dholliday,
you have posted a lot of logs ;) But that's pretty easy to identify - your wl-500g is using ppp0 as WAN interface. ifconfig said:
ppp0 Link encap:Point-Point Protocol
inet addr:xxx.xxx.xxx.xxx P-t-P:yyy.yyy.yyy.yyy Mask:255.255.255.255
UP POINTOPOINT RUNNING MULTICAST MTU:1492 Metric:1
RX packets:251513 errors:0 dropped:0 overruns:0 frame:0
TX packets:277856 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:170756422 (162.8 MiB) TX bytes:129834799 (123.8 MiB)
ppp0 has therefore crrently your public IP address. BTW did you really want to announce it?
Regards
Robert
Thank you akbor,
now I see. :) I could say that I wasn't reading enaugh carefully..., but I think it's to late... :D
My public IP is not a problem, because it is not static. So, carefully with "shooting" on this IP. :D
Now I have to play with "numbers" and rules in wshaper to get out maximum of my connection.
Thanks again for your quick and good help, akbor.