Temat: iptables tl-wr1043nd

Witam, wygenerowałem sobie skrypt za pomocą WRT54 Script Generator z myślą że zmienię kilka wartości i wszystko będzie działać ale niestety trochę mnie to przerosło... Skrypt dodaje w luci do Firewall -> Custom Rules. Na początek zmieniłem wpisy br0 na eth0 (nie wiem czy to jest poprawne) i to była w sumie cała moja modyfikacja big_smile Może ktoś go poprawić żeby wszystko zaczęło działać?

#--------------------------------------------
#WRT54 Script Generator v1.02
#(C) 2006-2007 Robert "Robson" Mytkowski
#--------------------------------------------
TCA="tc class add dev eth0"
TFA="tc filter add dev eth"
TQA="tc qdisc add dev eth0"
SFQ="sfq perturb 10"                    
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 19000kbit
$TCA parent 1:1 classid 1:10 htb rate 13000kbit ceil 19000kbit prio 0
$TCA parent 1:1 classid 1:11 htb rate 4000kbit ceil 15000kbit prio 2
$TCA parent 1:1 classid 1:12 htb rate 1900kbit ceil 15000kbit prio 2
$TCA parent 1:1 classid 1:13 htb rate 100kbit ceil 5000kbit prio 4
$TQA parent 1:10 handle 10: $SFQ
$TQA parent 1:11 handle 11: $SFQ
$TQA parent 1:12 handle 12: $SFQ
$TQA parent 1:13 handle 13: $SFQ
$TFA parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10
$TFA parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFA parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFA parent 1:0 prio 4 protocol ip handle 13 fw flowid 1:13
iptables -t mangle -A POSTROUTING -d 192.168.1.2 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 192.168.1.3 -j MARK --set-mark 11
iptables -t mangle -A POSTROUTING -d 192.168.1.7 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING -m iprange --dst-range 192.168.1.8-192.168.1.250 -j MARK --set-mark 13
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
modprobe imq
modprobe ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 1050kbit
$TCAU parent 1:1 classid 1:10 htb rate 800kbit ceil 1050kbit prio 0
$TCAU parent 1:1 classid 1:11 htb rate 100kbit ceil 500kbit prio 2
$TCAU parent 1:1 classid 1:12 htb rate 130kbit ceil 700kbit prio 2
$TCAU parent 1:1 classid 1:13 htb rate 20kbit ceil 200kbit prio 4
$TQAU parent 1:10 handle 10: $SFQ
$TQAU parent 1:11 handle 11: $SFQ
$TQAU parent 1:12 handle 12: $SFQ
$TQAU parent 1:13 handle 13: $SFQ
$TFAU parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10
$TFAU parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFAU parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFAU parent 1:0 prio 4 protocol ip handle 13 fw flowid 1:13
iptables -t mangle -A PREROUTING -s 192.168.1.2 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 192.168.1.3 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -s 192.168.1.7 -j MARK --set-mark 12
iptables -t mangle -A PREROUTING -m iprange --src-range 192.168.1.8-192.168.1.250 -j MARK --set-mark 13
iptables -t mangle -A PREROUTING -j IMQ --todev 0

2

Odp: iptables tl-wr1043nd

Przecież nie masz czegoś takiego jak eth0. br-lan jest. ifconfig trzeba było zrobić chociaż i zobaczyć jakie interfejsy masz dostępne.
modprobe nie ma, jest insmod. Dodatkowe pakiety do iptables musisz dograć.

A tak w ogóle to bez sensu to bo masz simpleshapera który ideologicznie robi to samo smile

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3 (edytowany przez carlo497 2011-10-18 12:40:49)

Odp: iptables tl-wr1043nd

mam brlan i eth0, ale nie spojrzalem ze eth0 nie ma w ogóle ip przypisanego. Z simpleshaperem mam zle wspomnienia dlatego chciałem to zrobić na podstawie iptables. Przerabiam skrypt i zabieram się za test

EDIT:
No i cholerstwo nie działa:/ składnia przy insmodzie jest taka sama jak przy tym poprzednim?

#--------------------------------------------
#WRT54 Script Generator v1.02
#(C) 2006-2007 Robert "Robson" Mytkowski
#--------------------------------------------
TCA="tc class add dev br-lan"
TFA="tc filter add dev br-lan"
TQA="tc qdisc add dev br-lan"
SFQ="sfq perturb 10"                    
tc qdisc del dev br-lan root
tc qdisc add dev br-lan root handle 1: htb
tc class add dev br-lan parent 1: classid 1:1 htb rate 19000kbit
$TCA parent 1:1 classid 1:10 htb rate 13000kbit ceil 19000kbit prio 0
$TCA parent 1:1 classid 1:11 htb rate 4000kbit ceil 15000kbit prio 2
$TCA parent 1:1 classid 1:12 htb rate 1900kbit ceil 15000kbit prio 2
$TCA parent 1:1 classid 1:13 htb rate 100kbit ceil 5000kbit prio 4
$TQA parent 1:10 handle 10: $SFQ
$TQA parent 1:11 handle 11: $SFQ
$TQA parent 1:12 handle 12: $SFQ
$TQA parent 1:13 handle 13: $SFQ
$TFA parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10
$TFA parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFA parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFA parent 1:0 prio 4 protocol ip handle 13 fw flowid 1:13
iptables -t mangle -A POSTROUTING -d 192.168.1.2 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 192.168.1.3 -j MARK --set-mark 11
iptables -t mangle -A POSTROUTING -d 192.168.1.7 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING -m iprange --dst-range 192.168.1.8-192.168.1.250 -j MARK --set-mark 13
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
insmod imq
insmod ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 1050kbit
$TCAU parent 1:1 classid 1:10 htb rate 800kbit ceil 1050kbit prio 0
$TCAU parent 1:1 classid 1:11 htb rate 100kbit ceil 500kbit prio 2
$TCAU parent 1:1 classid 1:12 htb rate 130kbit ceil 700kbit prio 2
$TCAU parent 1:1 classid 1:13 htb rate 20kbit ceil 200kbit prio 4
$TQAU parent 1:10 handle 10: $SFQ
$TQAU parent 1:11 handle 11: $SFQ
$TQAU parent 1:12 handle 12: $SFQ
$TQAU parent 1:13 handle 13: $SFQ
$TFAU parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10
$TFAU parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFAU parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFAU parent 1:0 prio 4 protocol ip handle 13 fw flowid 1:13
iptables -t mangle -A PREROUTING -s 192.168.1.2 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 192.168.1.3 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -s 192.168.1.7 -j MARK --set-mark 12
iptables -t mangle -A PREROUTING -m iprange --src-range 192.168.1.8-192.168.1.250 -j MARK --set-mark 13
iptables -t mangle -A PREROUTING -j IMQ --todev 0

4

Odp: iptables tl-wr1043nd

Simpleshaper robi dokładnie to samo - to skrypt który woła iptables/tc. Inaczej zapisane.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: iptables tl-wr1043nd

to chyba się z nim przeproszę i może go ujarzmię wink

6

Odp: iptables tl-wr1043nd

Dalsza zabawa - openwrt ma swój firewall. Jak dodajesz przez -A POST/PRE to poleci to na koniec reguł i nie zadziała, bo te openwrt będą pierwsze. kmod-imq zainstalowałeś chociaż?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: iptables tl-wr1043nd

kmod-imq nie dotykałem sprawdziłem tylko czy insmod jest w systemie. Narazie wziąłem się za tego simpleshapera. Jak tam dodać regułę dla zakresu ip np od 192.168.1.10 - 192.168.1.200

8

Odp: iptables tl-wr1043nd

Nie ma. Każde ip oddzielnie.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.