Disable loopback interface lo0 on 10.8.4? For testing purposes (testing raw network speed over a number of cables) i have equippped my Mac Book pro with a Thunderbolt to Gigabit Ethernet Adapter besides the built-in gigabit ethernet connection.

Both interfaces have been assigned a manual IP in the 10.0.*/24 range.

Starting iperf with iperf -s --bind 10.0.0.1, then starting the client with iperf -c 10.0.0.1 yields speeds of over 40 Gigabit per second. I assume (correctly so according to some googling) that not the interface itself is used but rather the local loopback interface as both IPs reside on the same computer. So my thought was to disable lo0, even just temporarily by issuing sudo ifconfig lo0 down. Thies doesn't work (it might have worked once for a few seconds but I can't prove that). lo0 just stays up.

Is there a way to (temporarily) disable the local loopback interface lo0 so I can do my tests?

Thanks!
The version of iperf I have (from Homebrew) does indeed allow binding the client and server to different interfaces, like so:

iperf -s --bind 10.0.0.1
iperf -c 10.0.0.1 --bind 10.0.0.2


(for the purpose of this answer I assume that you want the server on .1 and the client on .2)

The problem is that the routing table (visible through netstat -rn) appears to override this, sending traffic to 10.0.0.1 through the loopback interface.

Rather than disabling loopback altogether, you can delete that specific route:

sudo route delete 10.0.0.1 127.0.0.1


I found that this caused my Mac to be unable to reach itself (on that IP) for a few seconds, until it found an alternate route out the other interface and through my router. Once that route showed up in netstat -rn, iperf worked fine. Here's my before and after:

[  4] local 192.168.2.99 port 5001 connected with 192.168.2.101 port 5001
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  16.7 GBytes  14.3 Gbits/sec


And after:

[  4] local 192.168.2.99 port 5001 connected with 192.168.2.101 port 5001
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec   343 MBytes   288 Mbits/sec


288Mbps being a fairly reasonable speed considering that one of the interfaces in use is 802.11n wireless.

I was also able to return my routing table to normal by simply toggling the interface off and on again.