<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Linux Forum &mdash; Хеш шейпер проверьте скрипт]]></title>
		<link>https://linuxforum.ru/viewtopic.php?id=19914</link>
		<atom:link href="https://linuxforum.ru/extern.php?action=feed&amp;tid=19914&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Хеш шейпер проверьте скрипт».]]></description>
		<lastBuildDate>Tue, 31 Jan 2012 20:28:06 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Хеш шейпер проверьте скрипт]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=247491#p247491</link>
			<description><![CDATA[<p>Созрела необходимость создать шейпер на хеш таблицах. Опыт администрирования linux сравнительно небольшой. Написал скрипт задающий следующие настройки</p><div class="codebox"><pre><code>#корень
sudo tc qdisc add dev eth1 root handle 1:0 htb default 90
sudo tc class add dev eth1 parent 1:0 classid 1:1 htb rate 10Mbit

#таблицы
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 100:0 protocol ip u32 divisor 16

sudo tc filter add dev eth1 parent 1:0 prio 1 handle 1:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 2:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 3:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 4:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 5:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 6:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 7:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 8:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 9:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 10:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 11:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 12:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 13:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 14:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 15:0 protocol ip u32 divisor 256
sudo tc filter add dev eth1 parent 1:0 prio 1 handle 16:0 protocol ip u32 divisor 256

sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:0:0 match ip dst 192.168.0.0/24 hashkey mask 0x000000ff at 16 link 1:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:1:0 match ip dst 192.168.1.0/24 hashkey mask 0x000000ff at 16 link 2:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:2:0 match ip dst 192.168.2.0/24 hashkey mask 0x000000ff at 16 link 3:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:3:0 match ip dst 192.168.3.0/24 hashkey mask 0x000000ff at 16 link 4:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:4:0 match ip dst 192.168.4.0/24 hashkey mask 0x000000ff at 16 link 5:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:5:0 match ip dst 192.168.5.0/24 hashkey mask 0x000000ff at 16 link 6:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:6:0 match ip dst 192.168.6.0/24 hashkey mask 0x000000ff at 16 link 7:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:7:0 match ip dst 192.168.7.0/24 hashkey mask 0x000000ff at 16 link 8:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:8:0 match ip dst 192.168.8.0/24 hashkey mask 0x000000ff at 16 link 9:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:9:0 match ip dst 192.168.9.0/24 hashkey mask 0x000000ff at 16 link 10:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:a:0 match ip dst 192.168.10.0/24 hashkey mask 0x000000ff at 16 link 11:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:b:0 match ip dst 192.168.11.0/24 hashkey mask 0x000000ff at 16 link 12:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:c:0 match ip dst 192.168.12.0/24 hashkey mask 0x000000ff at 16 link 13:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:d:0 match ip dst 192.168.13.0/24 hashkey mask 0x000000ff at 16 link 14:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:e:0 match ip dst 192.168.14.0/24 hashkey mask 0x000000ff at 16 link 15:
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 100:f:0 match ip dst 192.168.15.0/24 hashkey mask 0x000000ff at 16 link 16:

sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 800:0:0 match ip dst 192.168.0.0/20 hashkey mask 0x00000f00 at 16 link 100:

# нарезка для каждого ПК
sudo tc class add dev eth1 parent 1:1 classid 1:100c htb rate 2048Kbit prio 5 
sudo tc qdisc add dev eth1 parent 1:100c handle 100c:0 sfq perturb 10
sudo tc filter add dev eth1 parent 1:0 protocol ip u32 ht 1:c:0 match ip dst 192.168.0.12/32 hashkey mask 0x000000ff at 16 classid 1:100c
...
...

# класс по умолчанию 
sudo tc class add dev eth1 parent 1:1 classid 1:90 htb rate 16Kbit prio 10
sudo tc qdisc add dev eth1 parent 1:90 handle 90:0 sfq perturb 10</code></pre></div><p>Запускаю. Все вроде работает. <br />Подскажите, правильно реализован принцип хеш таблиц? Что можно улучшить?</p><p>ОС: ubuntu server 10.04 x86 и ubuntu server 11.10 x64</p>]]></description>
			<author><![CDATA[null@example.com (trksergey)]]></author>
			<pubDate>Tue, 31 Jan 2012 20:28:06 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=247491#p247491</guid>
		</item>
	</channel>
</rss>
