Router emulation

Computer Science

One of the main purposes of my CS 560 class (advanced networking) was to study network architecture and routing protocols. Thus, our biggest programming project was building our own pseudo network where we could test things out. Each student implemented a switch and network client, and then we put all these switches and clients on a network and played around with routing tables and DHCP and RSVP and MPLS and Multicast and so on to see whose switch best followed protocols, and whose switch would stay up the longest without crashing. Mine won, of course. It was pretty fun.

I did mine in Java, and a lot of other people did theirs in C++. I think the Java approach ended up being easier in the long run. Anyway, here's the code and the jar files:

To get things running, start up a switch by opening a command prompt and typing: "java -jar switch.jar host:port subnet mask." For example, "java -jar switch.jar localhost:3011 192.168.2.1 255.255.255.0".

Then, you can start up a client by opening another command prompt and typing: "java -jar client.jar host:port." In the case of our previous switch, that would be "java -jar client.jar localhost:3011".

Start up as many clients as you want. Each will be given a unique address, and you should be able to send messages to the other clients.

If you have a second machine on your local network, you can also start up another switch with a different subnet and add that to the mix--they listen to each other over port 1234. When we were testing this out in the lab, each student had several different switches running, meaning I think we had about 50 to 60 subnets going.

Note that the switch has an artificial throughput limit. This is so we could better simulate RSVP and MPLS--it'd be hard to tell what was going on if we had to really saturate the network with packets before it'd start dropping packets.

Posted March 25, 2001 (12:12 PM)