In the late 1980s I wanted to teach a course on microprocessors and LANs. For the LAN part I wanted the students to be able to design their own LAN protocols. Brian Davis wrote the original VNET. This used TCP sockets and Sun O/S signals to deliver packets between hosts. This was an emulator, not a simulator, insofar as it actually delivered packets between various hosts on a real network. Students could design their own LAN protocols-- checksum, source & destination addresses, etc, and specify either an Ethernet or token ring topology. Using signals meant that we had some problems with queueing incoming packets: we had to use a small delay to ensure that signals and packets were not lost.
In 2000 Florence Fowler rewrote VNET from scratch. We used UDP sockets and POSIX threads on the department's workstations, which were now running Solaris: we no longer needed signals. VNET gets fired up on any number of workstations. A config file specifies the real CS host (e.g. cetus7), the VNET alias (e.g. delta2), the VNET "IP address" (e.g. 10.10.5.2), cross- traffic, and reliability (e.g. 80.0 means that 20% of delivered packets will get one random bit flipped) for each VNET host on a network segment. In addition, a host can have more than one interface--as in the case of a router. So some hosts can be on multiple network segments, and have a different alias and "IP address" in each. I taught a course in UNIX Network Programming for Fall, 2000 (with Florence Fowler as my GTA). Students wrote a chunk of the TCP/IP stack: the IP, UDP, and socket layers. Client and server UDP apps could talk to each other, and some students later added TCP as independent study projects. Finally, we added static routing (a RIP-like IP-layer routing) to tie 5 subnets together, and then added gateways with dynamic RIP-like routing to let groups of students tie their LANs together-- like a small internet. So we could have a client on a host for group A's LAN send a packet through several group A routers to a gateway, across the "internet" to B's gateway, through several more gateways to group E's gateway, then through group E's routers to a server. Code ran about 5-6K lines of C.
I taught UNIX Network programming Fall 2000, 2001, 2002, (and 2003). I wanted to teach a course on routing using Jeff Doyle's Routing TCP/IP books--this would stress routing rather than the TCP/IP stack. Peter Oelgoetz modified VNET to produce VRNET (VNET with routing). The config file now included parameters that let connections fail--e.g. every 60 seconds connection X has a 5% chance of failure, and in the event of failure, the link is down for a random period (e.g. 120 seconds). The config file also let you specify acutal (not simulated) delays--this lets you worry about timeouts. VRNET was used for the routing course Spring, 2003. In this course students wrote OSPF light--a somewhat simplified version of OSPF with backbone and areas, LSA-1's and LSA-3's. Philippe Hanset of TNS kindly set up a small lab with 4 Cisco 2500 series routers, so the students could configure real routers for OSPF and RIP operations. Chad Bauer, who took the course and was also my TA, made some modifications to VRNET, and Kent Galbraith is making some further modifications.
VNET and VRNET deliver whatever you give them to whoever you want. We used the real TCP/IP protocols and the real IP and UDP headers as well as the standard UDP socket calls: a server would do Socket, Bind, and Recvfrom (note 1st letter in caps) with standard UDP parameters. Socket, Bind, Recvfrom, etc then accessed the students' socket layer rather than the real Solaris kernel. Overall, we wanted a platform that let the students design and write the internet, the TCP/IP stack, routing, etc--so to speak--without needing root privileges. If you want to play with the slow start algorithm for TCP sliding windows, you can do so.