This semester, I'm taking a course (PIAM) about Internet protocols at the university. One of its main subjects are Internet routing protocols, of which we've seen RIP and OSPF as IGPs and BGP as the EGP.
In order to see their functionality in action, we set up a set of machines to simulate the Internet and/or isolated LANs, using the protocols mentioned above. You can imagine that we needed many routers to get this working (around 20), as all the class had to practise the same thing at once. But the routers that implement these protocols (specially BPG) are very expensive, so this is not affordable.
Instead, we use regular PCs running Linux to act as real routers. There is a wide variety of software to do this, but we used the GNU Zebra application. Zebra is a free routing software that runs on top of Unix systems and implements all the protocols mentioned above.
What I found very interesting, though, is that GNU Zebra is controlled through an IOS-like interface. It accepts most of the IOS commands verbatim, despite some of them are a bit different. Also note that this is not restricted to the routing protocols only: you can even set up the network interfaces and routing tables using this interface so it can be used to hide the underlying OS to anyone who already knows IOS.