Order switches by IP address

Fixes #1670