In Linux, there are usually two methods to speed up the network: iptables and TC, or combine them.
1. The simplest way
From: http://bbs.chinaunix.net/thread-833575-1-1.html
- The maximum upload speed of 192.168.0.2 is 30kb/s:
Iptables-a forward-s 192.168.0.2-m limit -- Limit 20/S-J Accep iptables-a forward-s 192.168.0.2 drop
When iptables is used, you need to clear the linked list first and then set the limit. Otherwise, the limit cannot be reached.
Sudo/usr/sbin/iptables-F clears the chain. After clearing the chain table, the Network may fail, use iptables-A input-J accept/iptables-A output-J accesudo/usr/sbin/iptables-A input-m limit -- limit 10/S-J accept to limit input to 10 packets per second
Sudo/usr/sbin/iptables-A output-m limit -- limit 10/S-J accept limit output is 10 packets per second sudo/usr/sbin/iptables-l list chain sudo /usr/sbin/iptables-A output-s 127.0.0.1-m limit -- Limit 20/S-J accept