[FUGSPBR] ALTQ
Mauricio Goto
freebsd-brasil em sys.adm.br
Seg Jan 13 17:15:15 BRST 2003
[goto] ~/altq-3.1> more INSTALL
INSTALL
1. Making ALTQ-kernel.
2. Installing userland tools
If you have problems to install ALTQ, see the TIPS document
in the docs directory.
0. Prepare FreeBSD-4.5-RELEASE (or NetBSD-1.5.2 or OpenBSD-3.0).
This release supports FreeBSD-4.5-RELEASE, NetBSD-1.5.2
and OpenBSD-3.0.
1. Making ALTQ-kernel.
1.1 Applying the patch to the kernel source tree and make a new kernel.
- the kernel patch only contains modifications to the existing
source files.
- the altq original files are provided in the separate
directory.
Put a fresh kernel source in /usr/src/sys-altq (recommended
directory name)
# cd /usr/src
# mkdir sys-altq
# cd sys
# tar cvf - . | (cd ../sys-altq; tar xf -)
Apply the altq kernel patch to the kernel source
# cd /usr/src/sys-altq
# patch -p0 < ALTQ_DIST/sys-altq/sys-altq-<os>-<ver>.patch
Here "ALTQ_DIST" is the altq distribution directory
(the top directory of the altq release).
<os> is either freebsd, netbsd or openbsd.
<ver> corresponds to your os version.
Copy the altq files to "sys-altq/altq" directory.
# mkdir altq
# cp ALTQ_DIST/sys-altq/altq/* altq/
If you are not familiar with how to make a kernel,
consult the FreeBSD handbook, Configuring the FreeBSD
Kernel section.
(/usr/share/doc/handbook/handbook.html or also available
at http://www.freebsd.org/handbook/handbook.html)
OpenBSD-3.0 already has the altq directory. Just override
the existing altq files.
if your kernel version is not supported (e.g., -stable):
try one of the patches close to your version.
the "patch" command might fail to patch some files.
you can find the failed files by
# find . -name "*.rej" -print
you also need to edit the ALTQ kernel config file that is
for the original version.
make and install the new kernel. (NetBSD and OpenBSD have
slightly different path names, e.g, arch/i386/conf.)
# cd i386/conf
# config ALTQ
# cd ../../compile/ALTQ
# make depend
# make clean
# make
# make install
# shutdown -r now
You might need to uncommnet "options ALTQ_NOPCC" in the config
file if your machine is
- 386/486 (non-pentium) CPUs which don't have TSC, or
- SMP
(by default, ALTQ uses processor cycle counter, Pentium TSC on i386
and PCC on alpha, for measuring time.)
See docs/TIPS.txt for more info about config options.
For FreeBSD, the default configuration includes no queueing
discipline but disciplines can be loaded at run time using KLD.
Disciplines can also be built-in by specifying them in the kernel
configuration file. (uncomment options in the ALTQ kernel config
file.)
1.2 making (or re-making) altq devices
# cd ALTQ_DIST
# sh MAKEDEV.altq all
the altq major device numbers for FreeBSD is 96. this is the
official number from FreeBSD.
(the device major number is defined in sys-altq/altq/altq_conf.c.)
1.3 loading altq queueing desciplines (for FreeBSD)
The altq kernel modules are automatically built and installed
as part of the kernel build/install.
To manually make the altq KLD modules:
# cd /usr/src/sys-altq/modules/altq
# make
# make install
the modules are installed in the "/modules" directory.
the altq modules have names starting with "altq_" (e.g., altq_cbq.ko).
altqd(8) tries to load required modules automatically so that
you do not need to "kldload" modules explicitly.
In case you want to manipulate the modules by hand,
To load a module:
# kldload altq_cbq
To check the loaded modules:
# kldstat -v
To unload a module:
# kldunload altq_cbq
2. Installing userland tools
% cd ALTQ_DIST
% make
# make install
(for NetBSD, do "make COPY=-c install")
By default, the ALTQ kernel source path is assumed at
"/usr/src/sys-altq".
You can change it by
make SYS_INCLUDES=-Iyour_kernel_path
(or, make a symbolic link from /usr/src/sys-altq to your kernel
source path)
By default, the altq tools are installed to /usr/local/{bin,sbin}.
You can change it by
make install PREFIX=your_install_prefix
2.1 Testing CBQ with local loop:
A sample config file for local loop is included.
It sets interface speed to 300Mbps and gives
10% of the interface bandwidth to TCP
10% of the interface bandwidth to UDP
thus, both TCP and UDP can get 30Mbps each.
To run altqd with this sample config:
# altqd -d -f altqd/altq.conf.samples/cbq.lo0
altqd lo0>
now cbq is enabled!
(with the "-d" option, altqd enters the command mode.)
Run a test with TCP or UDP:
Prepare a program to measure the throughput.
One of the easiest ways is to ftp to localhost,
but I recommend to use netperf
<http://www.netperf.org/netperf/NetperfPage.html>
netperf is also available from FreeBSD ports collection.
you can disable or enable cbq by
altqd lo0> cbq lo0 disable
altqd lo0> cbq lo0 enable
To exit
altqd lo0> quit
#
Terminating altqd (SIGINT or SIGTERM) also disables cbq.
For most users, altqd/altq.conf.samples/cbq.* will
be a good start point. Copy this file to /etc/altq.conf and edit.
-replace the interface name
-check the interface speed (10Mbps for Ethernet)
Then, run altqd.
see altq.conf(5) for how to set the config file.
2.2 Testing HFSC with local loop:
A sample config file for local loop is included.
It limits the bandwidth
10Mbps for TCP
5Mbps for UDP
To run altqd with this sample config:
# altqd -d -f altqd/altq.conf.samples/hfsc.lo0
altqd lo0>
Try HFSC as you did for CBQ.
duvidas?
[]x
> Alguem ai por acaso tem uma recetinha de bolo de como instalar / configurar
> / implementar o ALTQ no FreeBSD 4.7 ???
>
> ouvi boatos que precisa aplicar um patch no kernel.. isto confere ou pode
> ser feito sem isto ???
>
> GRato
>
> SkyWarrior
> chris em bsdux.com.br
>
>
> _______________________________________________________________
> Sair da Lista: http://www2.fugspbr.org/mailman/listinfo/fugspbr
> Historico: http://www4.fugspbr.org/lista/html/FUG-BR/
>
_______________________________________________________________
Sair da Lista: http://www2.fugspbr.org/mailman/listinfo/fugspbr
Historico: http://www4.fugspbr.org/lista/html/FUG-BR/
Mais detalhes sobre a lista de discussão freebsd