Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2010-11-30 16:17:25

  Pablik - Użytkownik

Pablik
Użytkownik
Zarejestrowany: 2010-10-21

[HTB] Ta sama kolejka dla 2 hostów

Witam oto konfiguracje mojej sieci
/etc/network/interfaces

Kod:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo br0
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 83.19.28.220
        netmask 255.255.255.248
        gateway 83.19.28.217
        network 83.19.28.0
        broadcast 83.19.28.255

iface eth1 inet manual
iface eth2 inet manual

iface br0 inet static
        bridge_ports eth1 eth2
        address 10.0.0.1
        netmask 255.0.0.0

/etc/default/dhcp3-server

Kod:

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="br0"

/etc/dhcp3/dhcpd.conf

Kod:

ddns-update-style none;
option domain-name-servers 194.204.159.1, 194.204.152.34;
default-lease-time 600;
max-lease-time 7200;

subnet 10.0.0.0 netmask 255.0.0.0 {
                option subnet-mask 255.0.0.0;
                option routers 10.0.0.1;
                option broadcast-address 10.0.0.255;


        ignore unknown-clients;

        #NR1
        host NR1 {
                hardware ethernet 00:1E:8C:78:49:C8;
                fixed-address 10.0.0.3;
        }
        i tam lista hostow
}

/etc/init.d/firewall

Kod:

# wlaczenie w kernelu forwardowania
echo 1 > /proc/sys/net/ipv4/ip_forward

# czyszczenie starych regul
iptables -F
iptables -X
iptables -t nat -X
iptables -t nat -F
iptables -t mangle -F
iptables -t mangle -X

# ustawienie domyslnej polityki
iptables -P INPUT ACCEPT
iptables -P FORWARD DROP
#iptables -P FORWARD Accept
iptables -P OUTPUT ACCEPT

# utrzymanie polaczen nawiazanych
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED

iptables -t nat -I PREROUTING -p tcp --dport 3389 -j DNAT --to 10.0.0.3:3389            #Pulpit Zdalny

# udostepniaie internetu w sieci lokalnej
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
iptables -I FORWARD -s 10.0.0.3 -m mac --mac-source 00:1E:8C:78:49:C8 -j ACCEPT
iptables -I FORWARD -s 10.0.0.4 -m mac --mac-source 70:5A:B6:2C:28:9B -j ACCEPT


iptables -I FORWARD -s 10.1.2.1 -m mac --mac-source 00:03:0D:84:30:6A -j ACCEPT         #P102 Olga
iptables -I FORWARD -s 10.1.2.2 -m mac --mac-source 00:03:0D:82:82:41 -j ACCEPT         #P102 Basia
iptables -I FORWARD -s 10.1.3.1 -m mac --mac-source 00:26:F2:60:2B:37 -j ACCEPT         #P103 Ola i kolezanka
iptables -I FORWARD -s 10.1.4.1 -m mac --mac-source 00:1D:72:01:36:C6 -j ACCEPT         #P104 Ada
iptables -I FORWARD -s 10.1.7.1 -m mac --mac-source 00:26:2D:7C:10:6D -j ACCEPT         #P107 Zielonka
iptables -I FORWARD -s 10.1.8.1 -m mac --mac-source 00:0E:2E:8C:C7:5D -j ACCEPT         #P108 Marta
iptables -I FORWARD -s 10.1.9.1 -m mac --mac-source 00:0B:6A:75:A7:91 -j ACCEPT         #P109 Rafal
iptables -I FORWARD -s 10.1.9.2 -m mac --mac-source 00:26:18:5E:DA:55 -j ACCEPT         #P109 Angela
iptables -I FORWARD -s 10.1.10.1 -m mac --mac-source 90:E6:BA:A0:EE:79 -j ACCEPT        #P110 Jacel
iptables -I FORWARD -s 10.2.2.1 -m mac --mac-source 00:0A:E6:96:8C:65 -j ACCEPT         #P202 Blizniaki
iptables -I FORWARD -s 10.2.5.1 -m mac --mac-source 40:61:86:19:64:BA -j ACCEPT         #P205 Sandra
iptables -I FORWARD -s 10.2.5.2 -m mac --mac-source E0:CB:4E:34:5F:72 -j ACCEPT         #P205 Marta
iptables -I FORWARD -s 10.2.6.1 -m mac --mac-source 00:0C:76:E5:46:15 -j ACCEPT         #P206 Jezus
iptables -I FORWARD -s 10.2.7.1 -m mac --mac-source 40:61:86:3E:03:B6 -j ACCEPT         #P207 Ogor
iptables -I FORWARD -s 10.2.7.2 -m mac --mac-source 00:03:0D:82:72:C4 -j ACCEPT         #P207 Henry
iptables -I FORWARD -s 10.2.8.1 -m mac --mac-source D4:85:64:EB:4E:C5 -j ACCEPT         #P208 Maciek
iptables -I FORWARD -s 10.2.10.1 -m mac --mac-source 00:0C:76:6A:A5:68 -j ACCEPT        #P210 Ania l2
iptables -I FORWARD -s 10.3.2.1 -m mac --mac-source 00:26:9E:10:47:F3 -j ACCEPT         #P302 Kamil
iptables -I FORWARD -s 10.3.5.1 -m mac --mac-source 00:16:36:48:C6:89 -j ACCEPT         #P305 Ula
iptables -I FORWARD -s 10.3.5.2 -m mac --mac-source 00:24:1D:D4:85:18 -j ACCEPT         #P305 Martyna
iptables -I FORWARD -s 10.3.6.1 -m mac --mac-source 00:03:0D:86:59:39 -j ACCEPT         #P306 Artur
iptables -I FORWARD -s 10.3.6.2 -m mac --mac-source 00:C0:A8:D9:F7:DB -j ACCEPT         #P306 Tomek
iptables -I FORWARD -s 10.3.7.1 -m mac --mac-source 00:23:54:54:49:A2 -j ACCEPT         #P307 Wojtek
iptables -I FORWARD -s 10.3.9.1 -m mac --mac-source 00:1E:33:C7:4F:51 -j ACCEPT         #P306 Alina
iptables -I FORWARD -s 10.3.16.1 -m mac --mac-source 00:1B:38:0F:F6:9A -j ACCEPT        #P316 Agnieszka

/etc/init.c/kolejkowanie

Kod:

tc qdisc del root dev br0
tc qdisc add dev br0 root handle 1:0 htb
tc class add dev br0 parent 1:0 classid 1:1 htb rate 10mbit ceil 10mbit

##########################################################################################################

tc class add dev br0 parent 1:1 classid 1:2 htb rate 2mbit ceil 5mbit prio 1                   #admin
tc class add dev br0 parent 1:1 classid 1:3 htb rate 80kbit ceil 512kbit prio 3                #P102 Olga
tc class add dev br0 parent 1:1 classid 1:4 htb rate 80kbit ceil 512kbit prio 3                #P102 Basia
tc class add dev br0 parent 1:1 classid 1:5 htb rate 80kbit ceil 512kbit prio 3                #P103 Ola i kolezanka
tc class add dev br0 parent 1:1 classid 1:6 htb rate 80kbit ceil 512kbit prio 3                #P104 Ada
tc class add dev br0 parent 1:1 classid 1:7 htb rate 80kbit ceil 512kbit prio 3                #P107 Zielonka
tc class add dev br0 parent 1:1 classid 1:8 htb rate 80kbit ceil 512kbit prio 3                #P108 Marta
tc class add dev br0 parent 1:1 classid 1:9 htb rate 80kbit ceil 512kbit prio 3                #P109 Rafal
tc class add dev br0 parent 1:1 classid 1:10 htb rate 80kbit ceil 512kbit prio 3               #P109 Angela
tc class add dev br0 parent 1:1 classid 1:11 htb rate 80kbit ceil 512kbit prio 3               #P110 Jacel
tc class add dev br0 parent 1:1 classid 1:12 htb rate 80kbit ceil 512kbit prio 3               #P202 Blizniaki
tc class add dev br0 parent 1:1 classid 1:13 htb rate 80kbit ceil 512kbit prio 3               #P205 Sandra
tc class add dev br0 parent 1:1 classid 1:14 htb rate 80kbit ceil 512kbit prio 3               #P205 Marta
tc class add dev br0 parent 1:1 classid 1:15 htb rate 80kbit ceil 512kbit prio 3               #P206 Jezus
tc class add dev br0 parent 1:1 classid 1:16 htb rate 80kbit ceil 512kbit prio 2               #P207 Ogor
tc class add dev br0 parent 1:1 classid 1:17 htb rate 80kbit ceil 512kbit prio 3               #P207 Henry
tc class add dev br0 parent 1:1 classid 1:18 htb rate 80kbit ceil 512kbit prio 3               #P208 Maciek
tc class add dev br0 parent 1:1 classid 1:19 htb rate 80kbit ceil 512kbit prio 3               #P210 Ania l2
tc class add dev br0 parent 1:1 classid 1:20 htb rate 80kbit ceil 512kbit prio 3               #P302 Kamil
tc class add dev br0 parent 1:1 classid 1:21 htb rate 80kbit ceil 512kbit prio 3               #P305 Ula
tc class add dev br0 parent 1:1 classid 1:22 htb rate 80kbit ceil 512kbit prio 3               #P305 Martyna
tc class add dev br0 parent 1:1 classid 1:23 htb rate 80kbit ceil 512kbit prio 3               #P306 Artur
tc class add dev br0 parent 1:1 classid 1:24 htb rate 80kbit ceil 512kbit prio 3               #P306 Tomek
tc class add dev br0 parent 1:1 classid 1:25 htb rate 80kbit ceil 512kbit prio 3               #P307 Wojtek
tc class add dev br0 parent 1:1 classid 1:26 htb rate 80kbit ceil 512kbit prio 3               #P306 Alina
tc class add dev br0 parent 1:1 classid 1:27 htb rate 80kbit ceil 512kbit prio 3               #P316 Agnieszka

##########################################################################################################

tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.0.0.3 flowid 1:2              #admin
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.2.1 flowid 1:3              #P102 Olga
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.2.2 flowid 1:4              #P102 Basia
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.3.1 flowid 1:5              #P103 Ola i kolezanka
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.4.1 flowid 1:6              #P104 Ada
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.7.1 flowid 1:7              #P107 Zielonka
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.8.1 flowid 1:8              #P108 Marta
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.9.1 flowid 1:9              #P109 Rafal
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.9.2 flowid 1:10             #P109 Angela
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.10.1 flowid 1:11            #P110 Jacel
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.2.1 flowid 1:12             #P202 Blizniaki
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.5.1 flowid 1:13             #P205 Sandra
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.5.2 flowid 1:14             #P205 Marta
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.6.1 flowid 1:15             #P206 Jezus
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.7.1 flowid 1:16             #P207 Ogor
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.7.2 flowid 1:17             #P207 Henry
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.8.1 flowid 1:18             #P208 Maciek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.10.1 flowid 1:19            #P210 Ania l2
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.2.1 flowid 1:20             #P302 Kamil
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.5.1 flowid 1:21             #P305 Ula
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.5.2 flowid 1:22             #P305 Martyna
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.6.1 flowid 1:23             #P306 Artur
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.6.2 flowid 1:24             #P306 Tomek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.7.1 flowid 1:25             #P307 Wojtek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.9.1 flowid 1:26             #P306 Alina
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.16.1 flowid 1:27            #P316 Agnieszka

Więc tak czas objasnic problem jak widzicie:
pasmo 4 MB rodzielam nastepujaco dla mnie (#Admin) na 2 MB i 25 hostom  po 80KB .
Lecz kupilem sobie laptopa (10.0.0.4) i chce zeby jemu przydzilane zostalo z mojej kolejki czyli np
(jak sciagam cos na stacjonarze  1mb to na laptopie mi zostaje 1 mb )

Zrobilem w ten sposob niewiem czy dobrze ale jakos dziala

Kod:

tc qdisc del root dev br0
tc qdisc add dev br0 root handle 1:0 htb
tc class add dev br0 parent 1:0 classid 1:1 htb rate 10mbit ceil 10mbit

##########################################################################################################

tc class add dev br0 parent 1:1 classid 1:2 htb rate 2mbit ceil 5mbit prio 1                   #admin
tc class add dev br0 parent 1:1 classid 1:3 htb rate 80kbit ceil 512kbit prio 3                #P102 Olga
tc class add dev br0 parent 1:1 classid 1:4 htb rate 80kbit ceil 512kbit prio 3                #P102 Basia
tc class add dev br0 parent 1:1 classid 1:5 htb rate 80kbit ceil 512kbit prio 3                #P103 Ola i kolezanka
tc class add dev br0 parent 1:1 classid 1:6 htb rate 80kbit ceil 512kbit prio 3                #P104 Ada
tc class add dev br0 parent 1:1 classid 1:7 htb rate 80kbit ceil 512kbit prio 3                #P107 Zielonka
tc class add dev br0 parent 1:1 classid 1:8 htb rate 80kbit ceil 512kbit prio 3                #P108 Marta
tc class add dev br0 parent 1:1 classid 1:9 htb rate 80kbit ceil 512kbit prio 3                #P109 Rafal
tc class add dev br0 parent 1:1 classid 1:10 htb rate 80kbit ceil 512kbit prio 3               #P109 Angela
tc class add dev br0 parent 1:1 classid 1:11 htb rate 80kbit ceil 512kbit prio 3               #P110 Jacel
tc class add dev br0 parent 1:1 classid 1:12 htb rate 80kbit ceil 512kbit prio 3               #P202 Blizniaki
tc class add dev br0 parent 1:1 classid 1:13 htb rate 80kbit ceil 512kbit prio 3               #P205 Sandra
tc class add dev br0 parent 1:1 classid 1:14 htb rate 80kbit ceil 512kbit prio 3               #P205 Marta
tc class add dev br0 parent 1:1 classid 1:15 htb rate 80kbit ceil 512kbit prio 3               #P206 Jezus
tc class add dev br0 parent 1:1 classid 1:16 htb rate 80kbit ceil 512kbit prio 2               #P207 Ogor
tc class add dev br0 parent 1:1 classid 1:17 htb rate 80kbit ceil 512kbit prio 3               #P207 Henry
tc class add dev br0 parent 1:1 classid 1:18 htb rate 80kbit ceil 512kbit prio 3               #P208 Maciek
tc class add dev br0 parent 1:1 classid 1:19 htb rate 80kbit ceil 512kbit prio 3               #P210 Ania l2
tc class add dev br0 parent 1:1 classid 1:20 htb rate 80kbit ceil 512kbit prio 3               #P302 Kamil
tc class add dev br0 parent 1:1 classid 1:21 htb rate 80kbit ceil 512kbit prio 3               #P305 Ula
tc class add dev br0 parent 1:1 classid 1:22 htb rate 80kbit ceil 512kbit prio 3               #P305 Martyna
tc class add dev br0 parent 1:1 classid 1:23 htb rate 80kbit ceil 512kbit prio 3               #P306 Artur
tc class add dev br0 parent 1:1 classid 1:24 htb rate 80kbit ceil 512kbit prio 3               #P306 Tomek
tc class add dev br0 parent 1:1 classid 1:25 htb rate 80kbit ceil 512kbit prio 3               #P307 Wojtek
tc class add dev br0 parent 1:1 classid 1:26 htb rate 80kbit ceil 512kbit prio 3               #P306 Alina
tc class add dev br0 parent 1:1 classid 1:27 htb rate 80kbit ceil 512kbit prio 3               #P316 Agnieszka

##########################################################################################################

tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.0.0.3 flowid 1:2              #Stacjonara
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.0.0.4 flowid 1:2              #Laptop
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.2.1 flowid 1:3              #P102 Olga
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.2.2 flowid 1:4              #P102 Basia
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.3.1 flowid 1:5              #P103 Ola i kolezanka
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.4.1 flowid 1:6              #P104 Ada
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.7.1 flowid 1:7              #P107 Zielonka
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.8.1 flowid 1:8              #P108 Marta
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.9.1 flowid 1:9              #P109 Rafal
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.9.2 flowid 1:10             #P109 Angela
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.1.10.1 flowid 1:11            #P110 Jacel
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.2.1 flowid 1:12             #P202 Blizniaki
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.5.1 flowid 1:13             #P205 Sandra
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.5.2 flowid 1:14             #P205 Marta
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.6.1 flowid 1:15             #P206 Jezus
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.7.1 flowid 1:16             #P207 Ogor
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.7.2 flowid 1:17             #P207 Henry
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.8.1 flowid 1:18             #P208 Maciek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.2.10.1 flowid 1:19            #P210 Ania l2
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.2.1 flowid 1:20             #P302 Kamil
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.5.1 flowid 1:21             #P305 Ula
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.5.2 flowid 1:22             #P305 Martyna
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.6.1 flowid 1:23             #P306 Artur
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.6.2 flowid 1:24             #P306 Tomek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.7.1 flowid 1:25             #P307 Wojtek
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.9.1 flowid 1:26             #P306 Alina
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.3.16.1 flowid 1:27            #P316 Agnieszka

Moje pytanie jest następujące ty to jest dobrze zrobione ?? czy on bieżne sobie kolejne 2 mb z tego pasa ??
Jeśli to jest zle zrobione to co mam zmienić żeby było dobrze ;P

Ostatnio edytowany przez Pablik (2010-11-30 16:20:24)

Offline

 

#2  2010-11-30 17:13:55

  BiExi - matka przelozona

BiExi
matka przelozona
Skąd: Gorlice
Zarejestrowany: 2004-04-16
Serwis

Re: [HTB] Ta sama kolejka dla 2 hostów

Jak najbardziej dobrze :]
po prostu masz założoną kolejkę 2megabitową i do niej dodane2 adresy i łączny transfer tych kompów nie przekroczy 2 megabitów

tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.0.0.3 flowid 1:2
tc filter add dev br0 protocol ip parent 1:0 u32 match ip dst 10.0.0.4 flowid 1:2

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Możesz wyłączyć AdBlock — tu nie ma reklam ;-)