跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Linux] 请教一下如何优雅的使用 TC 对大量的 IP 限速

发表于
使用一台 ubuntu 22.04 为 100 个 IP 提供 nat 上网服务,目前我们需要对这 100 个 IP 进行限速

假设总带宽为 1000mbit ,需要对每个 IP 的最大带宽限制为 10mbit ,且保证每个 IP 的带宽为 10mbit

看了相关教程后,目前我能想到的是为每个 IP 都创建一个 rate 为 10mbit 的 htb 类配合 sfq 来进行限速
这样就意味着 如果 3000 个 IP 就会有 3000 个 htb 子类和 sfq 规则, 这一点都不优雅了, 而且如此多的规则管理起来也是个麻烦事



经过多次查找资料后, 有一个思路就是 将 N 个 IP 加到 ipset 集合里面中去, 然后在 mangle 中对这个集合添加 fwmark,

然后 添加 tc filter 时匹配 该 fwmark, 理论上只需要添加一个 10mbit htb 类和 sfq 就行了


但是根据我查到的资料, 同一个 htb 类下, 所有在线的成员平分该 htb 的 rate , 这就会导致 一个人使用时是 10mbi 带宽, 两个人同时使用就是 5mbit 的带宽了

这就达不到最开始的需求了: 每个 IP 需要保证 10mbit 的带宽且最大仅可使用 10mbit 的带宽, 哪怕总带宽还有剩余


PS: 隔壁公司装修, 吵得脑子都大了, 表述可能有点啰嗦了, 请见谅

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.