I want to build a server with two NICs that I can deploy between a test machine and its uplink so I can reduce the network speed for testing some other software. I have read this routing post, how to set up a router and How do I limit internet bandwidth. I want this server to be transparent on the network; however, not a router.
I think it is possible with ebtables, see:
However you might have trouble getting the setup to be realistic (i.e. to behave like a network link that offers a rate equal to your throughput cap). This really depends on your requirements.
The average throughput will indeed be capped if you measure it over long periods (e.g. seconds), but if you do throttling in software the machine might process packets in bursts (meaning that you will have a processing delay a.k.a latency for each packet, and this delay might vary wildly between different packets). The effect is that for short time scales your throughput will be sometimes much higher than the cap, for others much lower. Only the averaged throughput over long periods will match the cap.
It is possible to lower the processing delay with some crazy optimizations, similar to those used in high-frequency trading, but it is very difficult and you will have to buy expensive hardware (e.g. racked servers) to get them working reliably.
If I were you, instead of spending money on the server, I would get a cheap managed switch (~$100). For instance SG-200s support rate limiting, see "Traffic Shaping" in the manual at page 174 https://www.cisco.com/c/dam/en/us/td/docs/switches/lan/csbss/sg200/administration_guide/78-19562.pdf These switches support rate limiting implemented in hardware and ideally should introduce a packet processing delay that is much smaller than what you get from a software box emulating the switch. You can also rest assured that it works correctly; anything you try to emulate in software needs to be tested and benchmarked carefully.
If you have very strict requirements, you might want to know that the cheap switches usually implement packet queuing using a method called WRR (weighted round robin). There is a more accurate rate limiting method called SRR (shaped round robin), for which the delay variations are even lower; however the price of those switches (certain Catalyst models) is usually above $1-2,000 because the chips run at a much higher clock frequency. Also, the fact that you have only one class of traffic might reduce the gap between them. The implementation difference between WRR and SRR is described here http://www.cisco.com/c/en/us/products/collateral/switches/catalyst-3560-e-series-switches/prod_qas0900aecd805bacc7.html (see Q. What is the difference between WRR and SRR in shared mode?)
(Of course there are other brands/models of managed switches that offer rate limiting; I'm not promoting anything, I'm just telling you about these because that's what I know about. Other brands/models most likely implement very similar mechanisms for rate limiting that might work just fine :) ).