# Limit internet speed

## knue

hi,

I live in a flat share. We all sit behind a router and share the internet connection. A cohabitant of me has big problems with playing computer games online when I download sth for example during a emerge or when I download some files with sftp from university. Is there a possibility to limit my speed to - let's say - max 100 K/s?Last edited by knue on Tue Jun 27, 2006 9:11 pm; edited 1 time in total

----------

## cyblord

bandwidth is how much you use.

I think you're trying to limit your speed?   :Confused: 

----------

## knue

Of course. I want to limit my speed. thank you

----------

## subceero

Knue, there are several possibilies, simpler ones and advanced ones   :Very Happy: 

A simple solution would be to use a userspace traffic limiter such as "trickle". With this you can specify the maximum speed in kb/s for a single application, for example firefox oder another download manager. If I remember correctly this is pretty easy and simple.

A more sophisticated solution would be to install a fully fledged traffic shaper on a router; this would allow to distribute the bandwith to a number of computers on your local network. It would be possible to priorize gaming services or hosts in your network to regular services or other hosts. As far as I know IP-Tables / ("hierarchical token bucket filter")and recent kernels are capable of such functions.

Hope this is of some help to you.

Rgds,

Sub

----------

## knue

 *subceero wrote:*   

> A simple solution would be to use a userspace traffic limiter such as "trickle". With this you can specify the maximum speed in kb/s for a single application, for example firefox oder another download manager. If I remember correctly this is pretty easy and simple.
> 
> 

 

Is this tool in portage?

----------

## cyblord

search for it:

```

emerge -s <packagename>

```

----------

## Shnoodle

```

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/www/www.gentoo.org/raw_cvs/gentoo-x86/net-misc/trickle/Attic/trickle-1.06.ebuild,v 1.8 2006/05/10 20:28:04 halcy0n dead $

DESCRIPTION="a portable lightweight userspace bandwidth shaper"

SRC_URI="http://www.monkey.org/~marius/${PN}/${P}.tar.gz"

HOMEPAGE="http://www.monkey.org/~marius/trickle/"

KEYWORDS="~amd64 ~ppc ~sparc ~x86"

SLOT="0"

LICENSE="BSD"

IUSE=""

DEPEND="virtual/libc

   dev-libs/libevent

   sys-apps/sed"

RDEPEND="virtual/libc"

inherit eutils

src_unpack() {

            unpack ${A}

            cd "${S}"

            epatch "${FILESDIR}"/trickle_1.07-4.diff.gz

}

src_compile() {

   econf || die "econf failed"

   make PREFIX=/usr || die

}

src_install() {

   einstall || die

}

```

Copy the above to "trickle-1.07.ebuild" and stick it in your portage overlay.

To create a portage overlay, follow these instructions http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuilds.

Then download the patch from http://ftp.debian.org/debian/pool/main/t/trickle/trickle_1.07-4.diff.gz and copy it to the "Files" directory in the portage overlay.

ebuild /PATH_TO_PORTAGE_OVERLAY/trickle-1.07.ebuild digest

echo "net-misc/trickle" >> /etc/portage/package.keywords

emerge trickle

----------

## knue

Thank you very much.

The ebuild worked great for me and

```
trickle -d 100 emerge foobar
```

did the trick (or should I better say the trickle  :Laughing:  )  for me.

However. I do not quite understand the demon mode. I want to limit normal downloads with konqueror or kget, too. And 

```
trickle -d 100 konqueror
```

does not work.

----------

## aaroedk

Hi there.

I'm trying to get that ebuild to work but it isn't going as smooth as I'd hoped.

This is the error I get when trying to run the 'ebuild /usr/local/portage/net-misc/trickle/trickle-1.07.ebuild digest':

```
!!! ERROR: net-misc/trickle-1.07 failed.

Call stack:

  ebuild.sh, line 1535:   Called source '/usr/local/portage/net-misc/trickle/trickle-1.07.ebuild'

' trickle-1.07.ebuild, line 19:   Called inherit 'eutils' '

  ebuild.sh, line 1257:   Called die

 

.eclass could not be found by inherit()

!!! If you need support, post the topmost build error, and the call stack if relevant.
```

And this is what I get when I try to run the ebuild file through bash.

```
localhost files # bash /usr/local/portage/net-misc/trickle/trickle-1.07.ebuild

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 4:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 5:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 6:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 7:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 8:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 9:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 10:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 11:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 12:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 13:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 16:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 17:

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 18:

/usr/local/portage/net-misc/trickle/trickle-1.07.ebuild: line 19: inherit: command not found

: command not foundnet-misc/trickle/trickle-1.07.ebuild: line 20:

'usr/local/portage/net-misc/trickle/trickle-1.07.ebuild: line 25: syntax error near unexpected token `

'usr/local/portage/net-misc/trickle/trickle-1.07.ebuild: line 25: `}
```

I really can't figure this one out so I hope someone out there can assist me.

Yours sincerely

Christian Rasmussen

----------

## pdr

You had a line wrap in there. The line that starts with "# $Header: /var/www/..." endsi wth "halcy0n dead $", not with ".ebuild,v"

----------

## aaroedk

 *pdr wrote:*   

> You had a line wrap in there. The line that starts with "# $Header: /var/www/..." endsi wth "halcy0n dead $", not with ".ebuild,v"

 

Thanks for you resposne, thought I'm note quite sure what you mean. Can I make you elaborate? I've tried various things in order to figure out exactly what you meant, but I still can't get it to work.

Thanks in advance

----------

## anonybosh

To set a limit on your D/L rates for emerges, you can define a couple of variables in your make.conf file (this suggestion specifically uses wget, the default file downloader for emerge):

```
FETCHCOMMAND="/usr/bin/wget --limit-rate=100k \${URI} -P \${DISTDIR}"

RESUMECOMMAND="/usr/bin/wget -c --limit-rate=100k \${URI} -P \${DISTDIR}"
```

There are lots of other nice goodies you can add too; just refer to 'wget --help' or 'man wget'.

----------

## MarcusXP

I am trying to install trickle-1.06 or trickle-1.07, and I get this error:

 *Quote:*   

> 
> 
> Server trickle # ebuild trickle-1.07.ebuild digest
> 
> : command not foundnet-misc/trickle/trickle-1.06.ebuild: line 4:
> ...

 

the command at line 4 is: 

 *Quote:*   

> inherit eutils

 

It seems this command is not known on my system. If I run it manually, I also get error:

 *Quote:*   

> Server trickle # inherit eutils
> 
> -su: inherit: command not found
> 
> 

 

Anyone knows what package I need to install in order to be able to run the "inherit" command ?

thank you in advance,

----------

## Kobboi

inherit() is a function defined in /usr/lib/portage/bin/ebuild.sh. It is trying to load something with no name, is there an empty inherit line in the ebuild?

----------

## Paczesiowa

what's the status of trickle? 1.07 even with "-9" patch from debian unstable fails to compile (some automake error complaining about automake versino mismatch 1.10.1 - 1.10.3, but 1.10.1 is not in portage anymore).

----------

## remix

can someone point me in the right direction, trickle-1.07 isn't compiling for me and is failing at make PREFIX=/usr

```
 * Messages for package net-misc/trickle-1.07:

 * ERROR: net-misc/trickle-1.07 failed (compile phase):

 *   (no error message)

 * 

 * Call stack:

 *     ebuild.sh, line  85:  Called src_compile

 *   environment, line 2006:  Called die

 * The specific snippet of code:

 *       make PREFIX=/usr || die

 * 

```

```
# emerge --info '=net-misc/trickle-1.07'

Portage 2.1.10.65 (hardened/linux/amd64, gcc-4.3.6, glibc-2.12.2, 2.6.37-hardened-r7 x86_64)

=================================================================

                         System Settings

=================================================================

System uname: Linux-2.6.37-hardened-r7-x86_64-AMD_Athlon-tm-_II_X2_240_Processor-with-gentoo-2.1

Timestamp of tree: Wed, 06 Feb 2013 01:30:01 +0000

app-shells/bash:          4.2_p20

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.6.8, 2.7.3-r2, 3.1.5, 3.2.3

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.3.6-r1, 4.4.6-r1, 4.5.3-r2

sys-devel/gcc-config:     1.6

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 3.4 (virtual/os-headers)

sys-libs/glibc:           2.12.2

Repositories: gentoo x-gentoo_overlay

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -march=amdfam10 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -march=amdfam10 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://gentoo.cites.uiuc.edu/pub/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage/gentoo_overlay"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="acl amd64 bash-completion bzip2 cli cracklib crypt curl custom-cflags cxx dri fastcgi gdbm gpm hardened iconv justify mcve mmx modules mudflap multilib mysql ncurses nls nptl openmp pam pax_kernel pcre php readline session sqlite sqlite3 sse sse2 ssl tcpd unicode urandom v8 xml xmlreader zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
```

----------

