# How to rate limit incoming bandwidth for an entire subnet?

**URL:** <https://hostingthreads.com/t/how-to-rate-limit-incoming-bandwidth-for-an-entire-subnet/53>\
**Category:** Linux Troubleshooting\
**Tags:** network, linux\
**Created:** [March 31, 2026, 7:31pm UTC](https://hostingthreads.com/t/how-to-rate-limit-incoming-bandwidth-for-an-entire-subnet/53 "2026-03-31T19:31:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennifer](https://hostingthreads.com/user_avatar/hostingthreads.com/jennifer/32/27_2.png) [@jennifer](https://hostingthreads.com/u/jennifer)\
**Post date:** [March 31, 2026, 7:31pm UTC](https://hostingthreads.com/t/how-to-rate-limit-incoming-bandwidth-for-an-entire-subnet/53/1 "2026-03-31T19:31:56Z")

</div>

Hello all,

How do I impose bandwidth restrictions on incoming packets across an entire subnet using tc in Alma Linux 8, 9, and later?

Thanks, Jenn

---

<div class="post-metadata">

**Author:** ![sohailqamar](https://hostingthreads.com/user_avatar/hostingthreads.com/sohailqamar/32/31_2.png) [@sohailqamar](https://hostingthreads.com/u/sohailqamar)\
**Post date:** [March 31, 2026, 7:46pm UTC](https://hostingthreads.com/t/how-to-rate-limit-incoming-bandwidth-for-an-entire-subnet/53/2 "2026-03-31T19:46:25Z")

</div>

Hi,

You can use the tc (traffic control) utility combined with an ifb (Intermediate Functional Block) device to limit incoming traffic rates for an entire subnet. The following commands provide a step-by-step process to set this up:

Load and activate the IFB module

```plaintext
modprobe ifb

ip link set dev ifb0 up

```

Clear any existing traffic control configurations

```plaintext
tc qdisc del dev enp1s0 root

tc qdisc del dev ifb0 root

tc qdisc del dev enp1s0 ingress

```

Attach an ingress qdisc to the network interface

```plaintext
tc qdisc add dev enp1s0 ingress

```

Redirect incoming subnet traffic to the IFB device

```plaintext
# tc filter add dev enp1s0 parent ffff: protocol ip prio 1 u32 match ip src 192.0.2.0/255.255.255.0 action mirred egress redirect dev ifb0

```

Set up HTB shaping on the IFB interface

```plaintext
# tc qdisc add dev ifb0 root handle 1: htb default 30

# tc class add dev ifb0 parent 1: classid 1:1 htb rate 20mbit ceil 20mbit

```

Apply traffic filtering and shaping rules

```plaintext
tc filter add dev ifb0 protocol ip parent 1: prio 1 u32 match ip src 192.0.2.0/255.255.255.0 flowid 1:1

```

Here are examples where the tc command was executed on the server, followed by transferring a file via scp to verify the speed under a 20 Mb/s restriction.

```auto
# scp TestFile root@192.168.1.1:/root
root@192.0.2.50's password: 
TestFile 100% 200MB 2.3MB/s 01:11    

# scp TestFile root@192.158.1.1:/root
root@192.0.2.50's password: 
sample_40MB_file3 100% 40MB 2.4MB/s 00:20  

```

Let me know if it solves at your end.

Richard 🙏
