<p>If your goal is just to get a stable Bitcoin node running, and not to contribute to the network, you can add <code>listen=0</code> to your bitcoin.conf file. This generally (though not always) keeps your upload bandwidth in check.</p>

<p>If you want to contribute to the Bitcoin network without using up too much of your own bandwidth, however, there are ways of limiting your upload speed for Bitcoin Core (Bitcoin-qt) only. Instructions depend on your OS, so what follows is a breakdown on what to do with each OS.</p>

<p><strong>IMPORTANT NOTE:</strong> If you limit the bandwidth of Bitcoin Core far below your actual upload speed, it can actually harm the Bitcoin network instead of helping it. To be a responsible maintainer of the Bitcoin network, you should test your upload speed and then set your outgoing bandwidth limit to be as close to your actual speed as possible (e.g. 90%). This guide is intended solely for people whose internet connections go unresponsive due to Bitcoin Core completely saturating their upload bandwidth.</p>

<p>The following instructions are abridged from this article I wrote recently:
<a href="https://www.maxlaumeister.com/blog/how-to-limit-bandwidth-of-bitcoin-core-on-windows-mac-os-and-linux/" rel="nofollow noreferrer">https://www.maxlaumeister.com/blog/how-to-limit-bandwidth-of-bitcoin-core-on-windows-mac-os-and-linux/</a></p>

<hr>

<h1>Limiting Bitcoin Bandwidth on Windows</h1>

<ol>
<li><p><a href="https://netbalancer.com/" rel="nofollow noreferrer">Download and Install NetBalancer</a>.</p></li>
<li><p>Start Bitcoin Core if it isn’t already running.</p></li>
<li><p>Run NetBalancer.</p></li>
<li><p>Find “bitcoin-qt.exe” in the list of running applications in the NetBalancer dialog and double-click it to change its bandwidth rules.</p></li>
<li><p>Under “Upload Priority” choose “Limited”, set the maximum amount of bandwidth for Bitcoin Core to use, and confirm.</p></li>
</ol>

<p>You’re done! NetBalancer will now sit in the background and make sure Bitcoin Core doesn’t use more bandwidth than you want it to.</p>

<hr>

<h1>Limiting Bandwidth on Mac OS X</h1>

<h2>OS X 10.10 Yosemite and later</h2>

<p>For OS X 10.10 Yosemite and later, there is no easy way to limit the bandwidth of a particular application, but the overall system bandwidth can be limited as follows:</p>

<ol>
<li><p>Visit <a href="https://developer.apple.com/downloads/index.action?q=Hardware%20IO%20Tools" rel="nofollow noreferrer">Apple Developer Downloads</a> and log in with your Apple ID.</p></li>
<li><p>Search for “Hardware IO Tools for Xcode” and download the latest stable (non-beta) version.</p></li>
<li><p>Open the .dmg and double-click “Network Link Conditioner.prefpane” to install the prefpane. From now on, you can enable/disable Network Link Conditioner from System Preferences.</p></li>
<li><p>From the Network Link Conditioner pane in System Preferences, click “Manage Profiles”, then click the “+” button to add a new profile.</p></li>
<li><p>Edit the profile and add your desired maximum upload speed.</p></li>
<li><p>Save your edit, exit the profile manager, choose your new profile, and flip the big switch to enable the limiter.</p></li>
</ol>

<p>Mac OS will place an icon in your notification tray so you remember that it’s on. Unlike the Windows/Linux solutions, this will limit the bandwidth for your entire system, so be sure to turn it off you’re not running Bitcoin Core.</p>

<h2>OS X 10.9 Mavericks and earlier</h2>

<p>For OS X 10.9 Mavericks you can <a href="http://www.techrepublic.com/article/configure-apples-built-in-network-firewall-with-icefloor/" rel="nofollow noreferrer">use IceFloor to configure bandwidth rules</a>. For 10.8 Mountain Lion and earlier, <a href="http://naleid.com/blog/2008/10/06/how-the-other-half-lives-bandwidth-throttling-on-the-mac-using-waterroofipfw" rel="nofollow noreferrer">use Waterroof</a>. Alternatively, if you want a simple way to control the overall system bandwidth limit instead of just Bitcoin Core, follow the instructions above for OS X 10.10 Yosemite and later.</p>

<hr>

<h2>Limiting Bandwidth on Linux</h2>

<ol>
<li><p>Make sure you have tc installed by typing <code>tc</code> at the command line. If you get “command not found”, install tc using your favorite package manager. If you're on a Debian-based distribution, the easiest way to install tc is by using <code>apt-get</code>:</p>

<p><code>sudo apt-get update</code></p>

<p><code>sudo apt-get install iproute2</code></p></li>
<li><p>Download the tc.sh script from the official Bitcoin Core repository using wget:</p>

<p><code>wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/qos/tc.sh</code></p></li>
<li><p>Open the script in a text editor. Find the line that says <code>IF="eth0"</code> and change <code>eth0</code> to reflect the network interface that your internet connection runs through. To get a list of your computer's network interfaces, use <code>ifconfig</code> on the command line. My computer is connected wirelessly through <code>wlan1</code>, so the IF line of my tc.sh looks like this:</p>

<p><code>IF="wlan1"</code></p></li>
<li><p>LINKCEIL should reflect the limit of the network interface, and most likely does not need to be changed.</p>

<p><code>LINKCEIL="1gbit"</code></p></li>
<li><p>Change LIMIT to be the maximum bandwidth you want Bitcoin Core to use (I chose 1mbit). If you don’t have any other Bitcoin Core nodes in your local network, you can delete the line that says LOCALNET. This line is there to make a bandwidth exception for port 8333 communications within your local network (i.e. not out to the internet).</p>

<p><code>LIMIT="1mbit"</code></p>

<p>Leave the rest of the commands in tc.sh alone unless you know what you're doing. The final top section of my tc.sh ended up looking like this:</p>

<pre><code>#network interface on which to limit traffic
IF="wlan1"

#limit of the network interface in question
LINKCEIL="1gbit"

#limit outbound Bitcoin protocol traffic to this rate
LIMIT="1mbit"
</code></pre></li>
<li><p>Exit your editor and make the script executable with the following command:</p>

<p><code>chmod +x ./tc.sh</code></p></li>
<li><p>Run the script as superuser:</p>

<p><code>sudo ./tc.sh</code></p>

<p>Your Bitcoin Core bandwidth will be throttled until you reboot your computer!</p></li>
</ol>

<p>Optionally, you can set the script to run every time you start your computer. Instructions for running scripts on boot will vary depending on your Linux distribution. On Ubuntu, <a href="https://askubuntu.com/a/1199/379181">one of the ways to run a script on boot</a> is by adding the script to your <code>/etc/rc.local</code> file.</p>

<h1>Conclusion</h1>

<p>Hopefully this post was helpful in showing you how to limit the bandwidth of Bitcoin Core! For the full version, including images and extra information, check out the <a href="https://www.maxlaumeister.com/blog/how-to-limit-bandwidth-of-bitcoin-core-on-windows-mac-os-and-linux/" rel="nofollow noreferrer">original article here</a>.</p>

CC BY-SA 3.0
2016-01-16T17:39:44.407Z
I'm on a debian distribution and the tc package is not found. :( Halp.
Spencer Ruport
CC BY-SA 3.0
2016-01-16T19:08:06.537Z
@SpencerRuport Actually I did more research and I would try `apt-get install iproute2` instead. I'm going to update my answer.
Maximillian Laumeister
CC BY-SA 3.0
2016-01-16T20:36:26.970Z
@MaximillianLaumeister - Awesome thanks :)
Spencer Ruport
CC BY-SA 3.0
2016-01-16T20:42:23.380Z
@MaximillianLaumeister - So I got it to work. Aptitude told me that `iproute2` was already installed but the script was giving me an error: `RTNETLINK answers: No such file or directory`. I installed `iproute` and it worked. (Or at least, I didn't receive any errors.)
Spencer Ruport
CC BY-SA 3.0
2016-01-16T20:44:31.000Z
@SpencerRuport Oh thank you! I don't have an extra debian box to test on, so it's much appreciated that you're helping me correct my answer. `iproute` it is :)
Maximillian Laumeister
CC BY-SA 3.0
2016-01-18T18:24:03.203Z
@MaximillianLaumeister - No problem. Thanks for following up. Do you have any recommendations on how I could determine if the script is working?
Spencer Ruport
CC BY-SA 3.0
2016-01-18T18:26:24.867Z
@SpencerRuport I might try a command-line tool called `nethogs`. More info in [this serverfault question](https://serverfault.com/questions/248223/how-do-i-know-what-processes-are-using-the-network).
Maximillian Laumeister
CC BY-SA 3.0
2017-11-01T20:08:55.613Z
Does limiting the bandwidth when being a full node actually hurt the network more than not being a full node at all?  Question asked here: https://bitcoin.stackexchange.com/questions/61629/as-a-full-node-does-limiting-bitcoind-bandwidth-hurt-the-network/61685#61685
schulwitz
CC BY-SA 4.0
2018-10-16T22:24:43.363Z
You were right before. It's iproute2, not iproute on debian. The RTNETLINK error appears the first time you run the script but not on subsequent times. /sbin/tc is in the iproute2 package and not in the iproute package. The iproute package is actually empty, and simply depends on iproute2.
Chris Moore
CC BY-SA 4.0
2018-10-17T00:55:26.380Z
@ChrisMoore Thank you for that data point, I have updated the answer accordingly.
Maximillian Laumeister
CC BY-SA 4.0
2021-06-06T17:01:03.217Z
Why would the threshold under which the node hurts the network be relative to the node's network bandwith and what is meant with "far below"? Many have GiB/s fibre to the home these days but need to stay below a few hundred GiB transfer volume per month to not risk that the provider terminates the contract. This requires limiting bandwidth to a lower MBit/s range. How can this be hurtful when nodes behind an ADSL connection are ok?
Joachim Wagner
CC BY-SA 4.0
2015-07-19T20:05:28.910Z
2018-10-16T22:34:50.027Z
2018-10-16T22:34:50.027Z
Maximillian Laumeister
<p>One answer mentioned in the thread is to add</p>

<pre><code>listen=0
</code></pre>

<p>to your bitcoin.conf (which is in {User}\AppData\Roaming\Bitcoin).</p>

<p>This stops other nodes connecting to you to download the blockchain, hence stopping the large upstream bandwidth consumption</p>

CC BY-SA 3.0
2013-07-08T08:00:32.487Z
Not really, since you still connect to a number of nodes in the network they might also ask for blocks and transactions that you saw, but they did not yet. You do however limit the number of connections. It's a really rough cap though.
cdecker
CC BY-SA 3.0
2015-11-26T18:04:58.590Z
But what if you want to run a full node?
Geremia
CC BY-SA 3.0
2013-07-05T22:18:21.953Z
2013-07-05T22:18:21.953Z
Paul Hatcher
<p>If your bitcoin client is running on a dedicated linux machine you might want to try <a href="https://github.com/magnific0/wondershaper" rel="nofollow">wondershaper</a>. It allows you to limit the bandwith of your network adapter. For instance</p>

<pre><code>sudo wondershaper eth0 1024 56
</code></pre>

<p>limits your bandwith to 1024 Kbps download and 56 Kbps upload rate.</p>

<pre><code>sudo wondershaper -c eth0
</code></pre>

<p>clears interface limits and brings you back to full speed.</p>

CC BY-SA 3.0
2015-07-16T22:09:23.507Z
Is there a way to restrict `wondershaper` to a specific process (PID)?
Geremia
CC BY-SA 3.0
2014-10-30T07:45:36.647Z
2014-10-30T07:45:36.647Z
behas
<p>You can use <a href="https://git.ventilaar.nl/github/bitcoin/commit/9c3ee3b" rel="nofollow noreferrer">maxuploadtarget</a> by adding a line like:</p>
<pre><code>maxuploadtarget=5000
</code></pre>
<p>to the bitcoin.conf file in your .bitcoin directory.  The example above will set a daily soft upload limit of ~5GB/day.</p>
<p>Even better might be limiting the maxconnections with</p>
<pre><code>maxconnections=25
</code></pre>
<p>Below is a Perl script I have written that will run on Linux, and will automatically limit the maximum number of connections (and thus bandwidth) during the day, and then once nighttime rolls around, it will remove the connection/bandwidth restrictions. This way, while you are asleep, your Bitcoin full node can be making the most of your bandwidth, and when you're awake, the full node won't interfere with your web browsing during the day.</p>
<pre><code> #!/usr/bin/perl
 use warnings;
 use strict;
 
 #############################################################################################################
 #Program purpose: To configure a Bitcoin full node so bandwidth use is restricted during the day.
 #
 #How it works: The bitcoin.conf file is periodically modified so that Bitcoin runs with fewer connections
 #during the day (using less bandwidth), and unlimited connections (higher bandwidth) at night.
 #
 #How to run: On Linux, run within the Bitcoin /bin directory (i.e. the directory holding 'bitcoind').
 #############################################################################################################
 
 #Set the path of Bitcoin's bitcoin.conf file here:
 my $path_of_bitcoin_conf_file = $ENV{&quot;HOME&quot;} . &quot;/.bitcoin/bitcoin.conf&quot;;
 my $bitcoind_connection_max = 25; # The maximum number of connections for bitcoind to make during day hours.
 my $start_of_day_hour = 7; # 7 am.
 my $start_of_night_hour = 21; # 9 pm in 24 hour format.
 
 my $time_period_last = &quot;hasn't been recorded yet&quot;; #Records whether the last time check was &quot;day&quot; or &quot;night&quot;.
 
 #Run indefinitely, configuring node bandwidth restrictions based on time of day.
 while (1) {
     my $time_period_current = night_or_day();
     #When the day becomes night or night becomes day, configure bitcoin bandwidth accordingly.
     if ( $time_period_last ne $time_period_current ) {
         modify_bitcoin_conf_file($time_period_current);
         restart_bitcoind();
     }
     else{} #Night/day hasn't changed, check again in another minute.
     $time_period_last = $time_period_current;
     sleep 60;
 }
 
 #Modify bitcoin.conf to limit bandwidth during the day, but unlimited during the night.
 sub modify_bitcoin_conf_file {
     my $night_or_day = shift;
     my $last_line_of_bitcoin_conf_file;
     if ($night_or_day eq &quot;night&quot;){
         $last_line_of_bitcoin_conf_file = &quot;&quot;; #No maxconnections limit at night.
     }
     elsif ($night_or_day eq &quot;day&quot;){
         $last_line_of_bitcoin_conf_file = &quot;maxconnections=$bitcoind_connection_max\n&quot;;
     }
     else{die &quot;Error, no night or day\n&quot;;}
 
     #Check that bitcoin.conf exists and then open it for editing.
     if (-e $path_of_bitcoin_conf_file){
         open (my $bitcoin_conf_fh, &quot;&lt;&quot;, $path_of_bitcoin_conf_file);
         my @bitcoin_conf = &lt;$bitcoin_conf_fh&gt;;
         close $bitcoin_conf_fh;
         open ($bitcoin_conf_fh, &quot;&gt;&quot;, $path_of_bitcoin_conf_file);
         foreach my $line (@bitcoin_conf){
             print $bitcoin_conf_fh $line unless $line =~ m/maxconnections/;
         }
         print $bitcoin_conf_fh $last_line_of_bitcoin_conf_file;
         close $bitcoin_conf_fh;
         print &quot;The bitcoin.conf file has been changed to $night_or_day settings &quot;, scalar localtime, &quot;\n&quot;;
     }
     else {
         die &quot;Could not locate the bitcoin.conf file: '$path_of_bitcoin_conf_file'\n&quot;;
     }
 }
 
 sub restart_bitcoind {
     shut_down_bitcoin_if_running();
     start_bitcoind();
 }
 
 sub shut_down_bitcoin_if_running {
     #Check if Bitcoin is running.
     if ( bitcoind_is_running() ){
         print &quot;Bitcoin daemon is running, trying to shut down now. &quot;, scalar localtime, &quot;\n&quot;;
         shut_down_bitcoind();
     }
     else{
         print &quot;Bitcoin daemon is not running at the moment. &quot;, scalar localtime, &quot;\n&quot;;
     }
 }
 
 sub shut_down_bitcoind {
     if ( program_running(&quot;./bitcoin-cli stop&quot;, &quot;Bitcoin server stopping&quot;) ){
         sleep 10;
         #Verify bitcoind process has stopped.
         while ( bitcoind_is_running() ) {
             print &quot;Still waiting for Bitcoin daemon to shut down. &quot;, scalar localtime, &quot;\n&quot;;
             sleep 10;
         }
         print &quot;Bitcoin daemon successfully shut down. &quot;, scalar localtime, &quot;\n&quot;;
     }
     else{
         print &quot;Having problems shutting down Bitcoin daemon. &quot;, scalar localtime, &quot;\n&quot;;
     }
 }
 
 sub bitcoind_is_running {
     if ( program_running(&quot;ps -e&quot;, &quot;bitcoind&quot;) ){
         return 1;
     }
     else{
         return 0;
     }
 }
 
 sub start_bitcoind {
     unless ( system(&quot;./bitcoind -daemon&quot;) ){
         print &quot;Bitcoin server booting up. &quot;, scalar localtime, &quot;\n&quot;;
         sleep 30;
         #Verify Bitcoin server has fully booted.
         until ( bitcoin_server_is_up() ) {
             print &quot;Still waiting for Bitcoin server to fully load. &quot;, scalar localtime, &quot;\n&quot;;
             sleep 60;
 
         }
         print &quot;Bitcoin server has successfully loaded. &quot;, scalar localtime, &quot;\n&quot;;
     }
     else{
         print &quot;Having problems starting the Bitcoin daemon. &quot;, scalar localtime, &quot;\n&quot;;
     }
 }
 
 sub bitcoin_server_is_up {
     #If we can get a block count, then the server is booted.
     if ( program_running(&quot;./bitcoin-cli getblockcount&quot;, '^\d{6,}') ){
         return 1;
     }
     else{
         return 0;
     }
 }
 
 #Call a program with argument 1, and return true if its stdout matches argument 2.
 sub program_running {
     my ($shell_cmd, $stdout_match) = @_;
     open (my $prog_call, &quot;-|&quot;, $shell_cmd);
     while (my $stdout = &lt;$prog_call&gt;){
         if ($stdout =~ m/$stdout_match/){
             return 1;
         }
         else{} #Keep searching for match.
     }
     return 0; #Match not found.
 }
 
 #Determine if it's nighttime or daytime.
 sub night_or_day {
     my @current_time = localtime();
     my $current_hour = $current_time[2];
     if ($current_hour &gt;= $start_of_day_hour &amp;&amp; $current_hour &lt; $start_of_night_hour){
         return &quot;day&quot;;
     }
     else {
         return &quot;night&quot;;
     }
 }
</code></pre>

CC BY-SA 4.0
2022-01-27T03:36:08.263Z
2022-02-18T14:17:36.153Z
2022-02-18T14:17:36.153Z
schulwitz
<p>I've just finished the intial blockchain download/verify in my BitcoinQt client (17 hours..) and I now see that BitcoinQt is happily eating all of my upstream bandwidth. (About 110kByte/sec on my ADSL line.)</p>

<p>I'm going to be applying bandwidth limits to the app using <a href="http://www.hanynet.com/waterroof/">Waterroof</a>, which should probably work --</p>

<p>But shouldn't there be a built-in method for BitcoinQt to be more polite about its bandwidth consumption?  </p>

<bitcoin-core><bandwidth>
How can I limit bandwidth usage in Bitcoin-qt client?
gosmond
# How can I limit bandwidth usage in Bitcoin-qt client?

(Asked by: username_0 on 2013-02-18)

I've just finished the intial blockchain download/verify in my BitcoinQt client (17 hours..) and I now see that BitcoinQt is happily eating all of my upstream bandwidth. (About 110kByte/sec on my ADSL line.)

I'm going to be applying bandwidth limits to the app using [Waterroof](http://www.hanynet.com/waterroof/), which should probably work --

But shouldn't there be a built-in method for BitcoinQt to be more polite about its bandwidth consumption?

**Tags:** bitcoin-core, bandwidth


---

## 4 answers

### Answer by username_1 on 2015-07-19. Score: 10

If your goal is just to get a stable Bitcoin node running, and not to contribute to the network, you can add `listen=0` to your bitcoin.conf file. This generally (though not always) keeps your upload bandwidth in check.

If you want to contribute to the Bitcoin network without using up too much of your own bandwidth, however, there are ways of limiting your upload speed for Bitcoin Core (Bitcoin-qt) only. Instructions depend on your OS, so what follows is a breakdown on what to do with each OS.

**IMPORTANT NOTE:** If you limit the bandwidth of Bitcoin Core far below your actual upload speed, it can actually harm the Bitcoin network instead of helping it. To be a responsible maintainer of the Bitcoin network, you should test your upload speed and then set your outgoing bandwidth limit to be as close to your actual speed as possible (e.g. 90%). This guide is intended solely for people whose internet connections go unresponsive due to Bitcoin Core completely saturating their upload bandwidth.

The following instructions are abridged from this article I wrote recently:
<https://www.maxlaumeister.com/blog/how-to-limit-bandwidth-of-bitcoin-core-on-windows-mac-os-and-linux/>

---

# Limiting Bitcoin Bandwidth on Windows

1. [Download and Install NetBalancer](https://netbalancer.com/).
2. Start Bitcoin Core if it isn’t already running.
3. Run NetBalancer.
4. Find “bitcoin-qt.exe” in the list of running applications in the NetBalancer dialog and double-click it to change its bandwidth rules.
5. Under “Upload Priority” choose “Limited”, set the maximum amount of bandwidth for Bitcoin Core to use, and confirm.

You’re done! NetBalancer will now sit in the background and make sure Bitcoin Core doesn’t use more bandwidth than you want it to.

---

# Limiting Bandwidth on Mac OS X

## OS X 10.10 Yosemite and later

For OS X 10.10 Yosemite and later, there is no easy way to limit the bandwidth of a particular application, but the overall system bandwidth can be limited as follows:

1. Visit [Apple Developer Downloads](https://developer.apple.com/downloads/index.action?q=Hardware%20IO%20Tools) and log in with your Apple ID.
2. Search for “Hardware IO Tools for Xcode” and download the latest stable (non-beta) version.
3. Open the .dmg and double-click “Network Link Conditioner.prefpane” to install the prefpane. From now on, you can enable/disable Network Link Conditioner from System Preferences.
4. From the Network Link Conditioner pane in System Preferences, click “Manage Profiles”, then click the “+” button to add a new profile.
5. Edit the profile and add your desired maximum upload speed.
6. Save your edit, exit the profile manager, choose your new profile, and flip the big switch to enable the limiter.

Mac OS will place an icon in your notification tray so you remember that it’s on. Unlike the Windows/Linux solutions, this will limit the bandwidth for your entire system, so be sure to turn it off you’re not running Bitcoin Core.

## OS X 10.9 Mavericks and earlier

For OS X 10.9 Mavericks you can [use IceFloor to configure bandwidth rules](http://www.techrepublic.com/article/configure-apples-built-in-network-firewall-with-icefloor/). For 10.8 Mountain Lion and earlier, [use Waterroof](http://naleid.com/blog/2008/10/06/how-the-other-half-lives-bandwidth-throttling-on-the-mac-using-waterroofipfw). Alternatively, if you want a simple way to control the overall system bandwidth limit instead of just Bitcoin Core, follow the instructions above for OS X 10.10 Yosemite and later.

---

## Limiting Bandwidth on Linux

1. Make sure you have tc installed by typing `tc` at the command line. If you get “command not found”, install tc using your favorite package manager. If you're on a Debian-based distribution, the easiest way to install tc is by using `apt-get`:

   `sudo apt-get update`

   `sudo apt-get install iproute2`
2. Download the tc.sh script from the official Bitcoin Core repository using wget:

   `wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/qos/tc.sh`
3. Open the script in a text editor. Find the line that says `IF="eth0"` and change `eth0` to reflect the network interface that your internet connection runs through. To get a list of your computer's network interfaces, use `ifconfig` on the command line. My computer is connected wirelessly through `wlan1`, so the IF line of my tc.sh looks like this:

   `IF="wlan1"`
4. LINKCEIL should reflect the limit of the network interface, and most likely does not need to be changed.

   `LINKCEIL="1gbit"`
5. Change LIMIT to be the maximum bandwidth you want Bitcoin Core to use (I chose 1mbit). If you don’t have any other Bitcoin Core nodes in your local network, you can delete the line that says LOCALNET. This line is there to make a bandwidth exception for port 8333 communications within your local network (i.e. not out to the internet).

   `LIMIT="1mbit"`

   Leave the rest of the commands in tc.sh alone unless you know what you're doing. The final top section of my tc.sh ended up looking like this:

   ```
   #network interface on which to limit traffic
   IF="wlan1"

   #limit of the network interface in question
   LINKCEIL="1gbit"

   #limit outbound Bitcoin protocol traffic to this rate
   LIMIT="1mbit"

   ```
6. Exit your editor and make the script executable with the following command:

   `chmod +x ./tc.sh`
7. Run the script as superuser:

   `sudo ./tc.sh`

   Your Bitcoin Core bandwidth will be throttled until you reboot your computer!

Optionally, you can set the script to run every time you start your computer. Instructions for running scripts on boot will vary depending on your Linux distribution. On Ubuntu, [one of the ways to run a script on boot](https://askubuntu.com/a/1199/379181) is by adding the script to your `/etc/rc.local` file.

# Conclusion

Hopefully this post was helpful in showing you how to limit the bandwidth of Bitcoin Core! For the full version, including images and extra information, check out the [original article here](https://www.maxlaumeister.com/blog/how-to-limit-bandwidth-of-bitcoin-core-on-windows-mac-os-and-linux/).

> **Comments:**
> **username_2**: I'm on a debian distribution and the tc package is not found. :( Halp.  
> **username_1**: @username_2 Actually I did more research and I would try `apt-get install iproute2` instead. I'm going to update my answer.  
> **username_2**: @username_1 - Awesome thanks :)  
> **username_2**: @username_1 - So I got it to work. Aptitude told me that `iproute2` was already installed but the script was giving me an error: `RTNETLINK answers: No such file or directory`. I installed `iproute` and it worked. (Or at least, I didn't receive any errors.)  
> **username_1**: @username_2 Oh thank you! I don't have an extra debian box to test on, so it's much appreciated that you're helping me correct my answer. `iproute` it is :)  
> **username_2**: @username_1 - No problem. Thanks for following up. Do you have any recommendations on how I could determine if the script is working?  
> **username_1**: @username_2 I might try a command-line tool called `nethogs`. More info in [this serverfault question](https://serverfault.com/questions/248223/how-do-i-know-what-processes-are-using-the-network).  
> **username_3**: Does limiting the bandwidth when being a full node actually hurt the network more than not being a full node at all?  Question asked here: https://bitcoin.stackexchange.com/questions/61629/as-a-full-node-does-limiting-bitcoind-bandwidth-hurt-the-network/61685#61685  
> **username_4**: You were right before. It's iproute2, not iproute on debian. The RTNETLINK error appears the first time you run the script but not on subsequent times. /sbin/tc is in the iproute2 package and not in the iproute package. The iproute package is actually empty, and simply depends on iproute2.  
> **username_1**: @username_4 Thank you for that data point, I have updated the answer accordingly.  
> **username_5**: Why would the threshold under which the node hurts the network be relative to the node's network bandwith and what is meant with "far below"? Many have GiB/s fibre to the home these days but need to stay below a few hundred GiB transfer volume per month to not risk that the provider terminates the contract. This requires limiting bandwidth to a lower MBit/s range. How can this be hurtful when nodes behind an ADSL connection are ok?  

---

### Answer by username_6 on 2013-07-05. Score: 1

One answer mentioned in the thread is to add

```
listen=0

```

to your bitcoin.conf (which is in {User}\AppData\Roaming\Bitcoin).

This stops other nodes connecting to you to download the blockchain, hence stopping the large upstream bandwidth consumption

> **Comments:**
> **username_7**: Not really, since you still connect to a number of nodes in the network they might also ask for blocks and transactions that you saw, but they did not yet. You do however limit the number of connections. It's a really rough cap though.  
> **username_8**: But what if you want to run a full node?  

---

### Answer by username_9 on 2014-10-30. Score: 1

If your bitcoin client is running on a dedicated linux machine you might want to try [wondershaper](https://github.com/magnific0/wondershaper). It allows you to limit the bandwith of your network adapter. For instance

```
sudo wondershaper eth0 1024 56

```

limits your bandwith to 1024 Kbps download and 56 Kbps upload rate.

```
sudo wondershaper -c eth0

```

clears interface limits and brings you back to full speed.

> **Comments:**
> **username_8**: Is there a way to restrict `wondershaper` to a specific process (PID)?  

---

### Answer by username_3 on 2022-01-27. Score: 1

You can use [maxuploadtarget](https://git.ventilaar.nl/github/bitcoin/commit/9c3ee3b) by adding a line like:

```
maxuploadtarget=5000

```

to the bitcoin.conf file in your .bitcoin directory. The example above will set a daily soft upload limit of ~5GB/day.

Even better might be limiting the maxconnections with

```
maxconnections=25

```

Below is a Perl script I have written that will run on Linux, and will automatically limit the maximum number of connections (and thus bandwidth) during the day, and then once nighttime rolls around, it will remove the connection/bandwidth restrictions. This way, while you are asleep, your Bitcoin full node can be making the most of your bandwidth, and when you're awake, the full node won't interfere with your web browsing during the day.

```
 #!/usr/bin/perl
 use warnings;
 use strict;
 
 #############################################################################################################
 #Program purpose: To configure a Bitcoin full node so bandwidth use is restricted during the day.
 #
 #How it works: The bitcoin.conf file is periodically modified so that Bitcoin runs with fewer connections
 #during the day (using less bandwidth), and unlimited connections (higher bandwidth) at night.
 #
 #How to run: On Linux, run within the Bitcoin /bin directory (i.e. the directory holding 'bitcoind').
 #############################################################################################################
 
 #Set the path of Bitcoin's bitcoin.conf file here:
 my $path_of_bitcoin_conf_file = $ENV{"HOME"} . "/.bitcoin/bitcoin.conf";
 my $bitcoind_connection_max = 25; # The maximum number of connections for bitcoind to make during day hours.
 my $start_of_day_hour = 7; # 7 am.
 my $start_of_night_hour = 21; # 9 pm in 24 hour format.
 
 my $time_period_last = "hasn't been recorded yet"; #Records whether the last time check was "day" or "night".
 
 #Run indefinitely, configuring node bandwidth restrictions based on time of day.
 while (1) {
     my $time_period_current = night_or_day();
     #When the day becomes night or night becomes day, configure bitcoin bandwidth accordingly.
     if ( $time_period_last ne $time_period_current ) {
         modify_bitcoin_conf_file($time_period_current);
         restart_bitcoind();
     }
     else{} #Night/day hasn't changed, check again in another minute.
     $time_period_last = $time_period_current;
     sleep 60;
 }
 
 #Modify bitcoin.conf to limit bandwidth during the day, but unlimited during the night.
 sub modify_bitcoin_conf_file {
     my $night_or_day = shift;
     my $last_line_of_bitcoin_conf_file;
     if ($night_or_day eq "night"){
         $last_line_of_bitcoin_conf_file = ""; #No maxconnections limit at night.
     }
     elsif ($night_or_day eq "day"){
         $last_line_of_bitcoin_conf_file = "maxconnections=$bitcoind_connection_max\n";
     }
     else{die "Error, no night or day\n";}
 
     #Check that bitcoin.conf exists and then open it for editing.
     if (-e $path_of_bitcoin_conf_file){
         open (my $bitcoin_conf_fh, "<", $path_of_bitcoin_conf_file);
         my @bitcoin_conf = <$bitcoin_conf_fh>;
         close $bitcoin_conf_fh;
         open ($bitcoin_conf_fh, ">", $path_of_bitcoin_conf_file);
         foreach my $line (@bitcoin_conf){
             print $bitcoin_conf_fh $line unless $line =~ m/maxconnections/;
         }
         print $bitcoin_conf_fh $last_line_of_bitcoin_conf_file;
         close $bitcoin_conf_fh;
         print "The bitcoin.conf file has been changed to $night_or_day settings ", scalar localtime, "\n";
     }
     else {
         die "Could not locate the bitcoin.conf file: '$path_of_bitcoin_conf_file'\n";
     }
 }
 
 sub restart_bitcoind {
     shut_down_bitcoin_if_running();
     start_bitcoind();
 }
 
 sub shut_down_bitcoin_if_running {
     #Check if Bitcoin is running.
     if ( bitcoind_is_running() ){
         print "Bitcoin daemon is running, trying to shut down now. ", scalar localtime, "\n";
         shut_down_bitcoind();
     }
     else{
         print "Bitcoin daemon is not running at the moment. ", scalar localtime, "\n";
     }
 }
 
 sub shut_down_bitcoind {
     if ( program_running("./bitcoin-cli stop", "Bitcoin server stopping") ){
         sleep 10;
         #Verify bitcoind process has stopped.
         while ( bitcoind_is_running() ) {
             print "Still waiting for Bitcoin daemon to shut down. ", scalar localtime, "\n";
             sleep 10;
         }
         print "Bitcoin daemon successfully shut down. ", scalar localtime, "\n";
     }
     else{
         print "Having problems shutting down Bitcoin daemon. ", scalar localtime, "\n";
     }
 }
 
 sub bitcoind_is_running {
     if ( program_running("ps -e", "bitcoind") ){
         return 1;
     }
     else{
         return 0;
     }
 }
 
 sub start_bitcoind {
     unless ( system("./bitcoind -daemon") ){
         print "Bitcoin server booting up. ", scalar localtime, "\n";
         sleep 30;
         #Verify Bitcoin server has fully booted.
         until ( bitcoin_server_is_up() ) {
             print "Still waiting for Bitcoin server to fully load. ", scalar localtime, "\n";
             sleep 60;
 
         }
         print "Bitcoin server has successfully loaded. ", scalar localtime, "\n";
     }
     else{
         print "Having problems starting the Bitcoin daemon. ", scalar localtime, "\n";
     }
 }
 
 sub bitcoin_server_is_up {
     #If we can get a block count, then the server is booted.
     if ( program_running("./bitcoin-cli getblockcount", '^\d{6,}') ){
         return 1;
     }
     else{
         return 0;
     }
 }
 
 #Call a program with argument 1, and return true if its stdout matches argument 2.
 sub program_running {
     my ($shell_cmd, $stdout_match) = @_;
     open (my $prog_call, "-|", $shell_cmd);
     while (my $stdout = <$prog_call>){
         if ($stdout =~ m/$stdout_match/){
             return 1;
         }
         else{} #Keep searching for match.
     }
     return 0; #Match not found.
 }
 
 #Determine if it's nighttime or daytime.
 sub night_or_day {
     my @current_time = localtime();
     my $current_hour = $current_time[2];
     if ($current_hour >= $start_of_day_hour && $current_hour < $start_of_night_hour){
         return "day";
     }
     else {
         return "night";
     }
 }

```


---

