{"id":13595747,"url":"https://github.com/cproctor/tcp-ip-simulation","last_synced_at":"2026-01-02T05:10:59.564Z","repository":{"id":12692209,"uuid":"15364516","full_name":"cproctor/tcp-ip-simulation","owner":"cproctor","description":"Generates documents for a real-life TCP/IP simulation","archived":false,"fork":false,"pushed_at":"2019-04-06T16:45:49.000Z","size":22,"stargazers_count":24,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-06T18:45:46.901Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cproctor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-21T19:38:23.000Z","updated_at":"2024-01-04T20:44:17.000Z","dependencies_parsed_at":"2022-09-23T09:00:38.639Z","dependency_job_id":null,"html_url":"https://github.com/cproctor/tcp-ip-simulation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cproctor%2Ftcp-ip-simulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cproctor%2Ftcp-ip-simulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cproctor%2Ftcp-ip-simulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cproctor%2Ftcp-ip-simulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cproctor","download_url":"https://codeload.github.com/cproctor/tcp-ip-simulation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248049649,"owners_count":21039255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:01:56.873Z","updated_at":"2026-01-02T05:10:59.468Z","avatar_url":"https://github.com/cproctor.png","language":"Python","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"TCP/IP Simulation\n=================\n\nThis module generates the documents needed for a classroom (or schoolwide) \nsimulation of TCP/IP, the protocol that gets packets of information around \nthe internet. Use this to generate each player's instructions. You will also \nneed to mark out networks with loops of rope or tape on the floor, and lots \nof small scraps of paper--at least ten or twenty per player, each about the size\nof an index card. \n\nTo create the physical layout, start by creating Network 0 in the middle of the room\n(using rope or tape), with enough room for the students on Network 0 to sit around \nthe network. Then, create networks 11, 12, etc. (depending on the settings you used)\nso that they touch Network 0 at the middle of the room. If you have additional layers\nof subnets, continue to add them as circles touching their parent networks. When we\ntried this with 200 students in a gym, the subnets needed to be stretched out as narrow ovals\nso there was enough room for everyone.\n\nQuickstart\n----------\nTo generate the documents you need for a simulation, download this module\n(type the command below into Terminal):\n\n    git clone https://github.com/cproctor/tcp-ip-simulation.git\n\nThen go into the project, go into the `python` folder, and create a new script:\n\n    cd tcp-ip-simulation\n    cd python\n    touch my_simulation.py\n    open my_simulation.py\n\nHere's some sample code. You may need to fiddle with `max_nodes` and `nodes_per_nameserver`\nto find a network that feels good. \n\n    from tcpip_simulation import TcpIpSimulation\n\n    students_list = ['Suzie', 'Liza', 'Emily', 'Ann', 'Chandra', 'Minh Li',\n        'Alice', 'Lulu', 'Alejandra', 'Celeste', 'Mia', 'Silvia', 'Diane',\n        'Em', 'Jo', 'Gilia', 'Vallen']\n    sim = TcpIpSimulation(\n        students_list,\n        max_nodes=6,\n        nodes_per_nameserver=6,\n        ip_address_length=2\n    )\n    sim.print_tree()\n    sim.print_directory()\n    sim.generate_instructions()\n\nRun your file by typing `python my_simulation.py` into Terminal. You will see\nthe network map (gives a good overview of what's going on, but not required for\nthe simulation) and the directory (you'll need to give a copy of this to each \nnameserver). You now have an HTML file called `simulation.html` containing \ninstructions for each student:\n\n    open simulation.html\n\nOverview\n--------\nIn the network simulation, each student will play the role of a node on a \nnetwork (gateway nodes are on two networks). In the classroom, this means \nthat students will be scattered around the room, sitting on the floor, \nholding onto a loop of rope (gateway nodes hold two loops).  \n\nAny node may generate a request by filling out a data packet and then \nhanding it to another node she is connected to by rope. The FROM and \nTO fields of the data packet must contain an IP address. The MESSAGE\nfield may contain whatever fits into the box. For example:\n\n    --------------------------------------\n    TO:         101.100.100\n    FROM:       102.103.100\n    MESSAGE:    What is Lulu's IP address?\n    --------------------------------------\n\nWhen a node receives a \nrequest, she should look at the TO field. If the request is for her, \nshe should write a response back to the sender and throw away the \nrequest. If the request is not for her, she should pass it along to \nthe next person. \n\nSome nodes have special responsibilities. The nameservers have a lookup \ntable, translating peoples’ names into IP addresses. When the nameservers\nreceives a request for a name lookup, she should look up that person’s name \nand return a response containing that person’s name. Gateway nodes are \nresponsible for deciding which network they should forward requests to. Each \ngateway node is provided with a subnet mask--a pattern she can use to determine \nwhether a request belongs on her network. If a request matches the pattern, it \nshould be sent along the subnetwork; otherwise it should be sent along the main \nnetwork.\n\nEncourage the participants to send messages to whomever they want. Sometimes I \nalso encourage participants to mess with the system and see what they can get\naway with. The goal is to figure out the basic \nmechanics of communication. At the end of the first round, a discussion should \nuncover the following attributes of the system:\n\n- You have to query the nameserver before you can send messages to someone new.\n- Packets can take different amounts of time to get to their destination\n- There is no way to really know who the message came from. It is possible to \n  spoof other IP addresses. \n- It is possible to see what other people are talking about if you look at packets \n  that are not yours. A really malicious agent could replace packets with new packets,\n  and neither the sender nor the receiver would be able to detect it.\n\nIf the participants are ready for a greater challenge, ask them to transmit longer \nmessages to each other, which don’t fit in a single packet. \nBefore this second round, lead a discussion about\ncreating a protocol to transmit a message broken into several packets, a \nmeans of putting the messages back in order, and a means of re-requesting any \npacket that gets dropped. \n\nAfter the simulation, put students in small groups with different node types, so \nthey can discuss their various experiences. This could easily lead to a follow-up\nactivity with the linux `traceroute` utility. \n\nIf you try this with your students, I would love to hear how it went.\n\n-Chris Proctor\n\nchris@chrisproctor.net\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcproctor%2Ftcp-ip-simulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcproctor%2Ftcp-ip-simulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcproctor%2Ftcp-ip-simulation/lists"}