ravinet / mahimahi

Web performance measurement toolkit
GNU General Public License v3.0
241 stars 129 forks source link

Can mahimahi run on an intermediate forwarding server? #156

Open Yecccccc opened 2 years ago

Yecccccc commented 2 years ago

Hi, as shown in the image below, we want to deploy mahimahi on an intermediate server, making it a bottleneck. Can mahimahi run on an intermediate server? In other words, can mahimahi be deployed in such a server to forward traffic? thank you very much! QQ图片20220908101508

Nayald commented 2 years ago

Hi, I did something like this for some of my experiements. The way I did is to make a mm-link acts as a router. To achieve this, I write a script that move one of my physical interface inside the mm-link (namespace) with ip commands.

Here what I did from inside the mm-link, I previously define a root namespace with id 0 and a NAT rule with iptables:

ip netns exec root ip link set ens1 netns $$
ip link set ens1 up
ip addr add 192.168.1.100/32 dev ens1
ip route add 192.168.1.73/32 dev ens1
dev_name=$(ip netns exec root ip link | grep -oP "link-\d+")
ip netns exec root ip route add 192.168.1.73/32 dev $dev_name