{"id":16421764,"url":"https://github.com/peppelinux/common-open-research-emulator-core-tutorials","last_synced_at":"2025-10-26T22:30:40.141Z","repository":{"id":143289792,"uuid":"172248144","full_name":"peppelinux/Common-Open-Research-Emulator-CORE-Tutorials","owner":"peppelinux","description":"A very basic Network simulation tutorial with CORE Network","archived":false,"fork":false,"pushed_at":"2019-02-24T09:31:36.000Z","size":701,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-20T22:18:46.537Z","etag":null,"topics":["core-network","networking"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peppelinux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-23T18:21:00.000Z","updated_at":"2023-10-20T22:18:50.795Z","dependencies_parsed_at":"2023-05-11T02:00:31.630Z","dependency_job_id":null,"html_url":"https://github.com/peppelinux/Common-Open-Research-Emulator-CORE-Tutorials","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2FCommon-Open-Research-Emulator-CORE-Tutorials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2FCommon-Open-Research-Emulator-CORE-Tutorials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2FCommon-Open-Research-Emulator-CORE-Tutorials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2FCommon-Open-Research-Emulator-CORE-Tutorials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peppelinux","download_url":"https://codeload.github.com/peppelinux/Common-Open-Research-Emulator-CORE-Tutorials/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219862033,"owners_count":16555959,"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":["core-network","networking"],"created_at":"2024-10-11T07:34:44.835Z","updated_at":"2025-10-26T22:30:39.813Z","avatar_url":"https://github.com/peppelinux.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"CORE Network Tutorial\n---------------------\n\nThis is a Tutorial to get the base knowledge of CORE framework.\nThe configuration of this Tutorial is also available for download in [sources](sources/) folder.\n\n1. Install and Run CORE Network:\n    - 1.1 Please download packages or VMware image available from [CORE Network official download page](https://www.nrl.navy.mil/itd/ncs/products/core).\n    - 1.2 Install daemon and gui packages. _Hint: On ubuntu 16.04 and ubuntu 18.04 we got trusty packages to work_. \n    - 1.3 Run CORE daemon `/etc/init.d/core-daemon start`.\n\n2. Add a Router and rename it _firewall-router_, then add a physical interface to get a bridge on a real ifname on your workstation: \n    - 2.1 Configure (double click) the physical interface and select an ethernet interface of your workstation;\n    - 2.2 Remove ipv6 from _firewall_router_ if you don't need it;\n    - 2.3 Using _link tool_ link _firewall-router_ to the physical interface;\n    - _Hint: do not use wireless interface for bridging_\n\n    *Problem*: Every time you stop and start your CORE session the Bridge ifname will change on your workstation. Use a command to keep it handy.\n    ````\n    BRIFNAME=$(ifconfig | grep  \"^b.[0-9]\\{4\\}.[a-z0-9]*\"| awk -F' ' {'print $1'})\n    ````    \n    To make this persistent in a CORE session, as other preferencies, go to _Session -\u003e Hooks_ and configure as follow in picture:\n    ![Alt text](images/create_runtimehook.png)\n\n3. Run this first test.\n    - 3.1 On CORE Network window, run the emulation session clicking on the green arrow, in the left menu.\n    - 3.2 Open a terminal on your workstation, check available interfaces (`ifconfig` or `ip ad sh`). You will see at least two brand new interfaces, veth* and b.*. \n    - 3.3 On your Workstation run `brctl show` to check what interfaces is a bridge (probably b.*). You will also see that veth* is the interfaces linked to this bridge.\n    \n    \n    ![Alt text](images/3_testbridge_onlocalpc.png)\n    \n    \n    - 3.4 On your Workstation run `tcpdump -i $BRIFNAME`, you will see traffic from the _firewall_router_ like DHCP/BOOT and maybe some ARP request too.  Double click on _firewall_router_, it will open a terminal, see network the network interfaces and check its HWaddress, it's the same you get in the tcpdump stdout.\n    ````\n    # on your workstation\n    tcpdump -i $BRIFNAME\n    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode\n    listening on b.42777.a7, link-type EN10MB (Ethernet), capture size 262144 bytes\n    16:53:35.441144 IP 0.0.0.0.bootpc \u003e 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:00:00:aa:00:00 (oui Ethernet), length 300\n    16:53:44.446805 IP 0.0.0.0.bootpc \u003e 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:00:00:aa:00:00 (oui Ethernet), length 300\n    ````\n\n4. Configure the LAN 10.0.0.0/24 to link your workstation to _firewall_router_. Remember that $BRIFNAME is only a variable name, be sure that this will have a different value on your setup!\n    - 4.1 On your Workstation configure the ip with `ifconfig $BRIFNAME 10.0.0.254/24` or `ip ad ch 10.0.0.254/24 dev $BRIFNAME`\n    - 4.2 On your Workstation `ping 10.0.0.1` (_firewall_router_). Good news, a working layer2 was created from your workstation to your CORE Network session.\n    - 4.3 Disable unecessary routing services, all those that are not needed in this tutorial.\n    ![Alt text](images/firewall-router_services.png)\n    \n5. Enable supernetting, _firewall_router_ must reach internet. All these task must be executed on your workstation.\n    - 5.1 Enable ip_forward `echo 1 \u003e  /proc/sys/net/ipv4/ip_forward`.\n    - 5.2 NAT all the traffic from the bridge to internet using iptables. What's your ifname linked to internet? That is the output interface:\n        - `iptables -t nat -A POSTROUTING -s 10.0.0.1 -o wlp2s0 -j MASQUERADE`;\n        - 10.0.0.1 is the ip of _firewall_router_;\n        - wlp2s0 is the wireless interface that I'm using on my workstation to reach internet;\n    - 5.3 Configure a default gateway to _firewall_router_ with command `route add default gw 10.0.0.254`.\n    - 5.4 In _firewall-router_ shell test a foreign `ping to 8.8.8.8` or `tracepath -n 8.8.8.8`, you must see it work. Make it persistent.\n    ![Alt text](images/4_router_defgw_persistent.png)\n\n6. Create a persistent configuration in _firewall_router_ with CORE Network hook services.\n    - 6.1 This is an example to make a good resolv.conf into the _firewall_router_.\n        ![Alt text](images/4_router_resolvconf_persistent.png)\n        ![Alt text](images/4_router_resolvconf_persistent_2.png)\n    \n7. Create Collision Zones, the switched LANs in your CORE Network project.\n    - 7.1 Add network switches to simulate the real world. Remember that every switch will create a bridge interface in your Workstation, including all the interfaces linked in. This means that we can always sniff the traffic directly in the emulated network switch. Rename the switch _Aswitch_ and _Bswitch_.\n        ![Alt text](images/7_creates_switches_links.png)\n    - 7.2 Create two nodes, one in the A LAN and another in the B LAN.\n    - 7.3 In A1 and B1 configuration change _services.DefaultRoute_ configuring the correct _firewall_router_ ip.\n    - 7.4 Run a ]tracepath` from A1 to B1 and viceversa, this is a test to check if networks are now reachable each other through the _firewall_router_.\n\n8. Add some firewall rule in _firewall_router_ configuration:\n    - 8.1 Network A must reach internet and not B.\n        - 8.1.1 Enable _services.firewall_ in _firewall_router_.\n        - 8.1.2 Reject traffic in FORWARD chain, from A to B.\n          ````\n          # IMPORTANT: accept returning packets from B to A, otherwise packets from B will not be forwarded\n          # this means that if B reach A the forward will works because it was previously established \n          iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT\n          \n          # REJECT traffic from A to B, ip_forward will works but this rule will reject the packets\n          iptables -A FORWARD -s 10.0.1.0/24 -d 10.0.2.0/24 -j REJECT\n          ````\n        - 8.1.3 Add a masquerade rule to NAT all the traffic from A to Internet.\n          ````\n          iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -o eth0 -j MASQUERADE\n          ````\n    - 8.2 Network B must reach Internet and also A.\n        - 8.2.1 Add masquerade rule to NAT all the traffic from B to Internet\n          ````\n          iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE\n          ````\n\nResult\n------\nRemember: in `~/.core/configs` you will also find more complex examples.\n![Alt text](images/7_addnodes_removeips.png)\n\nTODO\n----\n- Make the tasks described in _8._ without iptables but using _Linux Advanced Routing and blackholes_.\n- Please contribute, suggest other basic use cases, opening an Issue or Pull Request.\n\n\nResources\n---------\n\n- http://www.brianlinkletter.com/core-network-emulator-test-drive/\n- http://www.brianlinkletter.com/core-network-emulator-services-overview/\n- http://www.brianlinkletter.com/core-network-emulator-install-network-services/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeppelinux%2Fcommon-open-research-emulator-core-tutorials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeppelinux%2Fcommon-open-research-emulator-core-tutorials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeppelinux%2Fcommon-open-research-emulator-core-tutorials/lists"}