chiwormjava 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +1079 -171
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiwormjava",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/readme.md CHANGED
@@ -43,222 +43,1139 @@ javacodewatch
43
43
  ---
44
44
 
45
45
  ---
46
+ Step 1: Place devices
47
+ Add in Packet Tracer:
48
+ 2 Routers (2621XM)
49
+ 2 Switches (2960)
50
+ 4 PCs
51
+
52
+ Arrange as:
53
+ PC1 PC2 PC3 PC4
54
+ | | | |
55
+ Switch1 Switch2
56
+ | |
57
+ Router1 ---- WAN ---- Router2
58
+
59
+ Step 2: Add Serial Ports
60
+ Click Router -> Physical tab
61
+ Turn Power OFF
62
+ Insert WIC-2T module
63
+ Turn Power ON
64
+ Now Serial0/0/0 and Serial0/0/1 will be available
65
+
66
+ Step 3: Connect cables
67
+ LAN:
68
+ PC to Switch using Copper Straight-Through
69
+ Switch to Router using Copper Straight-Through
70
+
71
+ WAN:
72
+ Use Serial DCE cable
73
+ Router1 Serial0/0/0 to Router2 Serial0/0/0
74
+
75
+ Step 4: Configure Router1
76
+ enable
77
+ configure terminal
78
+
79
+ interface gigabitEthernet 0/0
80
+ ip address 192.168.1.1 255.255.255.0
81
+ no shutdown
82
+ exit
83
+
84
+ interface serial 0/0/0
85
+ ip address 172.16.1.1 255.255.255.252
86
+ clock rate 64000
87
+ no shutdown
88
+ exit
89
+
90
+ Step 5: Configure Router2
91
+ enable
92
+ configure terminal
93
+
94
+ interface gigabitEthernet 0/0
95
+ ip address 10.0.0.1 255.255.255.248
96
+ no shutdown
97
+ exit
98
+
99
+ interface serial 0/0/0
100
+ ip address 172.16.1.2 255.255.255.252
101
+ no shutdown
102
+ exit
103
+
104
+ Step 6: Configure PCs
105
+ Left network:
106
+ PC1 IP 192.168.1.2 Mask 255.255.255.0 Gateway 192.168.1.1
107
+ PC2 IP 192.168.1.3 Gateway 192.168.1.1
108
+
109
+ Right network:
110
+ PC3 IP 10.0.0.2 Mask 255.255.255.248 Gateway 10.0.0.1
111
+ PC4 IP 10.0.0.3 Gateway 10.0.0.1
112
+
113
+ Step 7: Configure Routing
114
+ Router1:
115
+ ip route 10.0.0.0 255.255.255.248 172.16.1.2
116
+
117
+ Router2:
118
+ ip route 192.168.1.0 255.255.255.0 172.16.1.1
119
+
120
+ Step 8: Verify interfaces
121
+ Run:
122
+ show ip interface brief
123
+
124
+ Status should be up up
125
+ If not, use no shutdown
126
+
127
+ Step 9: Test connectivity
128
+ From PC1:
129
+ ping 10.0.0.2
130
+
131
+ Expected reply from destination
132
+
133
+ Step 10: Simulation Mode
134
+ Click Simulation
135
+ Reset Simulation
136
+ Edit Filters and select ARP and ICMP
137
+
138
+ Send packet using Add Simple PDU from PC1 to PC3
139
+ Click Play or Capture/Forward
140
+
141
+ Expected packet flow:
142
+ PC1 -> Switch1 -> Router1 -> Router2 -> Switch2 -> PC3
143
+
144
+ First ARP then ICMP communication successful
145
+
146
+
147
+
148
+ Step 1: Setting Up the Topology
149
+ Add devices:
150
+ 1 Router (2911 or similar)
151
+ 1 Switch (2960)
152
+ 3 PCs (PC0, PC1, PC2)
153
+ 1 Cloud or Server
154
+
155
+ Step 2: Assign IP Addresses
156
+ Private Network:
157
+ PC0 IP 192.168.1.2 Mask 255.255.255.0 Gateway 192.168.1.1
158
+ PC1 IP 192.168.1.3 Mask 255.255.255.0 Gateway 192.168.1.1
159
+ PC2 IP 192.168.1.4 Mask 255.255.255.0 Gateway 192.168.1.1
160
+
161
+ Step 3: Configure Router Interfaces
162
+ Router> enable
163
+ Router# configure terminal
164
+
165
+ Interface gig0/0
166
+ Router(config)# interface gig0/0
167
+ Router(config-if)# ip address 192.168.1.1 255.255.255.0
168
+ Router(config-if)# no shutdown
169
+
170
+ Interface gig0/1
171
+ Router(config)# interface gig0/1
172
+ Router(config-if)# ip address 203.0.113.1 255.255.255.0
173
+ Router(config-if)# no shutdown
174
+
175
+ Assign IP to Cloud/Server
176
+ IP 203.0.113.2
177
+ Mask 255.255.255.0
178
+
179
+ Step 4: Configure NAT
180
+ Define inside and outside interfaces
181
+ Router(config)# interface gig0/0
182
+ Router(config-if)# ip nat inside
183
+ Router(config-if)# exit
184
+
185
+ Router(config)# interface gig0/1
186
+ Router(config-if)# ip nat outside
187
+ Router(config-if)# exit
188
+
189
+ Configure PAT
190
+ Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
191
+ Router(config)# ip nat inside source list 1 interface gig0/1 overload
192
+
193
+ Step 5: Configure Routing
194
+ Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
195
+
196
+ Step 6: Test Configuration
197
+ From PC command prompt:
198
+ ping 203.0.113.2
199
+
200
+ If reply is received, NAT is working
201
+
202
+ Verify NAT translations
203
+ Router# show ip nat translations
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ AIM:
226
+ To analyze packet fragmentation by changing packet size and observing its effect using Wireshark.
227
+
228
+ Step 1: Open Wireshark
229
+ Launch Wireshark
230
+ Select active interface (WiFi or Ethernet)
231
+ Click Start Capture
232
+
233
+ Step 2: Check MTU size
234
+ Open Command Prompt and run:
235
+ netsh interface ipv4 show subinterfaces
236
+ Note MTU value (usually 1500 bytes)
237
+
238
+ Step 3: Test without fragmentation
239
+ ping 8.8.8.8 -f -l 1472
240
+ 1472 + 28 header = 1500, fits MTU
241
+ Output: Reply received, no fragmentation
242
+
243
+ Step 4: Force fragmentation error
244
+ ping 8.8.8.8 -f -l 2000
245
+ Output: Packet needs to be fragmented but DF set
246
+ Meaning: Packet too large and fragmentation not allowed
247
+
248
+ Step 5: Allow fragmentation
249
+ ping 8.8.8.8 -l 2000
250
+ Packet is divided into fragments
251
+ May observe delay or packet loss
252
+
253
+ Step 6: Analyze in Wireshark
254
+ Apply filter:
255
+ ip.flags.mf == 1 or ip.frag_offset > 0
256
+
257
+ Observation:
258
+ Multiple packets for single ping
259
+ Fragmented packets visible
260
+
261
+ Observations:
262
+ Fragmented packets have same Identification ID
263
+ Different Fragment Offset values
264
+ MF flag indicates more fragments
265
+ Last packet has MF = 0
266
+
267
+ Performance Impact:
268
+ More packets generated
269
+ Increased delay
270
+ Possible packet loss
271
+
272
+ Final Observation:
273
+ Small packet: No fragmentation
274
+ Large packet with DF: Error
275
+ Large packet without DF: Fragmentation occurs
276
+
277
+ Conclusion:
278
+ If packet size exceeds MTU, it is divided into smaller fragments, affecting performance
279
+
280
+ Output:
281
+ Ping command results showing success or error
282
+ Wireshark showing fragmented packets using filter
283
+
284
+ Result:
285
+ Fragmentation observed and analyzed successfully
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+ AIM:
306
+ To identify vulnerabilities and secure the network using Access Control List (ACL) and Port Security.
307
+
308
+ Step 1: Topology Setup
309
+ Add devices:
310
+ 1 Router (2911)
311
+ 1 Switch (2960)
312
+ 2 PCs
313
+
314
+ Step 2: Connections
315
+ PC1 FastEthernet0 to Switch Fa0/1 using Copper Straight-Through
316
+ PC2 FastEthernet0 to Switch Fa0/2 using Copper Straight-Through
317
+ Switch Fa0/24 to Router GigabitEthernet0/0
318
+
319
+ Step 3: Configure PCs
320
+ PC1 IP 192.168.1.10 Mask 255.255.255.0 Gateway 192.168.1.1
321
+ PC2 IP 192.168.1.20 Mask 255.255.255.0 Gateway 192.168.1.1
322
+
323
+ Step 4: Configure Router
324
+ enable
325
+ configure terminal
326
+ interface g0/0
327
+ ip address 192.168.1.1 255.255.255.0
328
+ no shutdown
329
+ exit
330
+
331
+ Step 5: Test Before Security
332
+ From PC2:
333
+ ping 192.168.1.10
334
+ Communication should be successful
335
+
336
+ Step 6: Apply ACL
337
+ access-list 1 deny 192.168.1.20
338
+ access-list 1 permit any
339
+
340
+ Apply ACL:
341
+ interface g0/0
342
+ ip access-group 1 in
343
+ exit
344
+
345
+ Step 7: Test After Security
346
+ From PC2:
347
+ ping 192.168.1.10
348
+ Should fail
349
+
350
+ From PC1:
351
+ ping 192.168.1.20
352
+ Should work
353
+
354
+ Step 8: Configure Port Security on Switch
355
+ enable
356
+ configure terminal
357
+ interface fa0/1
358
+ switchport mode access
359
+ switchport port-security
360
+ switchport port-security maximum 1
361
+ exit
362
+
363
+ Vulnerabilities Identified:
364
+ No access control
365
+ No device restriction
366
+ No traffic filtering
367
+
368
+ Security Measures Applied:
369
+ ACL controls communication between devices
370
+ Port Security restricts number of devices per port
371
+
372
+ Additional Concepts:
373
+ IDS detects suspicious activities such as unusual traffic
374
+ IPsec encrypts data for secure transmission
375
+
376
+ Simulation (Optional):
377
+ Use Simulation mode
378
+ Filter ICMP
379
+ Observe packet drop due to ACL
380
+
381
+ Final Result:
382
+ PC2 is blocked
383
+ PC1 is allowed
384
+ Switch ports are secured
385
+ Network is protected successfully
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+ AIM:
411
+ To demonstrate IP Spoofing attack and implement security measures to prevent unauthorized access.
412
+
413
+ Step 1: Topology Setup
414
+ Devices required:
415
+ 1 Router (2911)
416
+ 1 Switch (2960)
417
+ PC1 (Trusted user)
418
+ PC2 (Attacker)
419
+ 1 Server
420
+
421
+ Connections:
422
+ PC1 to Switch Fa0/1
423
+ PC2 to Switch Fa0/2
424
+ Switch Fa0/24 to Router G0/0
425
+ Server to Router G0/1
426
+
427
+ Step 2: IP Configuration
428
+ PC1 IP 192.168.1.10 Gateway 192.168.1.1
429
+ PC2 IP 192.168.1.20 Gateway 192.168.1.1
430
+ Server IP 10.0.0.2 Gateway 10.0.0.1
431
+
432
+ Step 3: Configure Router
433
+ enable
434
+ configure terminal
435
+
436
+ interface g0/0
437
+ ip address 192.168.1.1 255.255.255.0
438
+ no shutdown
439
+ exit
440
+
441
+ interface g0/1
442
+ ip address 10.0.0.1 255.255.255.0
443
+ no shutdown
444
+ exit
445
+
446
+ Step 4: Configure Routing
447
+ ip route 10.0.0.0 255.255.255.0 10.0.0.1
448
+
449
+ Step 5: Apply Trust-Based ACL
450
+ access-list 10 permit 192.168.1.10
451
+ access-list 10 deny any
452
+
453
+ interface g0/0
454
+ ip access-group 10 in
455
+
456
+ Step 6: Test Before Attack
457
+ From PC1:
458
+ ping 10.0.0.2 (should work)
459
+
460
+ From PC2:
461
+ ping 10.0.0.2 (should fail)
462
+
463
+ Step 7: Simulate IP Spoofing
464
+ Change PC2 IP to 192.168.1.10
465
+
466
+ Test again:
467
+ ping 10.0.0.2 (should work)
468
+
469
+ Step 8: Impact
470
+ Unauthorized access
471
+ Security bypass
472
+ Fake identity
473
+
474
+ Step 9: Countermeasure 1 Anti-Spoofing ACL
475
+ ip access-list extended ANTI-SPOOF
476
+ deny ip 192.168.1.0 0.0.0.255 any
477
+ permit ip any any
478
+
479
+ interface g0/1
480
+ ip access-group ANTI-SPOOF in
481
+
482
+ Step 10: Countermeasure 2 uRPF
483
+ interface g0/0
484
+ ip verify unicast source reachable-via rx
485
+
486
+ Step 11: Switch Port Security
487
+ enable
488
+ configure terminal
489
+
490
+ interface fa0/1
491
+ switchport mode access
492
+ switchport port-security
493
+ switchport port-security maximum 1
494
+ switchport port-security mac-address sticky
495
+ switchport port-security violation shutdown
496
+
497
+ Final Understanding:
498
+ Before ACL everyone allowed
499
+ ACL allows only trusted IP
500
+ Spoofing bypasses security
501
+ uRPF blocks spoofed packets
502
+
503
+ Conclusion:
504
+ IP-based trust is not secure and must be verified using mechanisms like uRPF and port security
505
+
506
+ Result:
507
+ Attack simulated successfully
508
+ Vulnerability identified
509
+ Security measures implemented
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+ AIM:
534
+ To allow normal UDP communication and block unwanted UDP traffic using ACL.
535
+
536
+ Step 1: Build the Network
537
+ Devices required:
538
+ 1 Router (2911)
539
+ 1 Switch (2960)
540
+ PC1 (Client)
541
+ PC2 (Attacker)
542
+ 1 Server
543
+
544
+ Connections:
545
+ PC1 FastEthernet0 to Switch Fa0/1
546
+ PC2 FastEthernet0 to Switch Fa0/2
547
+ Server FastEthernet0 to Switch Fa0/3
548
+ Switch Fa0/24 to Router GigabitEthernet0/0
549
+
550
+ Step 2: IP Configuration
551
+ PC1 IP 192.168.1.10 Gateway 192.168.1.1
552
+ PC2 IP 192.168.1.30 Gateway 192.168.1.1
553
+ Server IP 192.168.1.20
554
+ Subnet Mask 255.255.255.0
555
+
556
+ Step 3: Configure Router
557
+ enable
558
+ configure terminal
559
+ interface g0/0
560
+ ip address 192.168.1.1 255.255.255.0
561
+ no shutdown
562
+ exit
563
+
564
+ Step 4: Enable UDP Service on Server
565
+ Open Server -> Services -> DNS
566
+ Turn DNS ON
567
+ Add entry:
568
+ Name example.com
569
+ Address 192.168.1.20
570
+
571
+ Step 5: Test UDP Communication
572
+ From PC1:
573
+ nslookup example.com 192.168.1.20
574
+ UDP communication should work
575
+
576
+ Step 6: Apply ACL to Block Attacker
577
+ Router(config)# access-list 100 deny udp host 192.168.1.30 any
578
+ Router(config)# access-list 100 permit ip any any
579
+
580
+ Apply ACL:
581
+ interface g0/0
582
+ ip access-group 100 in
583
+ exit
584
+
585
+ Step 7: Test After ACL
586
+ From PC2:
587
+ nslookup example.com 192.168.1.20 (should fail)
588
+
589
+ From PC1:
590
+ nslookup example.com 192.168.1.20 (should work)
591
+
592
+ Step 8: Block DNS Service (Port-Based ACL)
593
+ Router(config)# access-list 101 deny udp any any eq 53
594
+ Router(config)# access-list 101 permit ip any any
595
+
596
+ Apply:
597
+ interface g0/0
598
+ ip access-group 101 in
599
+ exit
600
+
601
+ Test:
602
+ From PC1:
603
+ nslookup example.com 192.168.1.20 (should fail)
604
+
605
+ Step 9: Important Concept
606
+ If all devices are in same network, traffic bypasses router
607
+ Communication becomes PC -> Switch -> Server
608
+ ACL will not work
46
609
 
47
- ## Step 2: Add Serial Ports (MOST IMPORTANT FIX)
610
+ Step 10: Fix Topology
611
+ Change Server network:
612
+ Server IP 10.0.0.2 Gateway 10.0.0.1
48
613
 
49
- By default, routers don’t have serial ports.
614
+ Configure Router:
615
+ interface g0/1
616
+ ip address 10.0.0.1 255.255.255.0
617
+ no shutdown
50
618
 
51
- ### Do this for BOTH routers:
619
+ Now traffic flows through router:
620
+ PC -> Router -> Server
621
+ ACL works correctly
52
622
 
53
- 1. Click Router → **Physical tab**
54
- 2. Turn **Power OFF**
55
- 3. From modules:
56
- Drag **WIC-2T** into slot
57
- 4. Turn **Power ON**
623
+ Concepts:
624
+ UDP is fast and connectionless protocol
625
+ ACL filters traffic based on rules
626
+ Port 53 is used for DNS
627
+ Router must be in path for ACL to work
58
628
 
59
- Now you will see:
629
+ Result:
630
+ UDP communication tested
631
+ Attacker blocked using ACL
632
+ DNS service blocked using port-based ACL
633
+ Network secured successfully
60
634
 
61
- ```
62
- Serial0/0/0
63
- Serial0/0/1
64
- ```
65
635
 
66
- ---
67
636
 
68
- ## Step 3: Connect cables (CORRECT WAY)
69
637
 
70
- ### LAN connections
71
638
 
72
- * PC → Switch → **Copper Straight-Through**
73
- * Switch → Router (Gig0/0 or Fa0/0) → **Copper Straight-Through**
74
639
 
75
- ---
76
640
 
77
- ### WAN connection (Router ↔ Router)
78
641
 
79
- * Select **Serial DCE cable**
80
- * Router1 → `Serial0/0/0`
81
- * Router2 → `Serial0/0/0`
82
642
 
83
- ---
84
643
 
85
- ## Step 4: Configure Router1
86
644
 
87
- Go to CLI:
88
645
 
89
- ```bash
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+ AIM:
658
+ Create a network, enable DNS (UDP), allow normal user, and block attacker using ACL.
659
+
660
+ Step 1: Topology
661
+ PC1 (Client) and PC2 (Attacker) connected to Switch
662
+ Switch connected to Router G0/0
663
+ Router G0/1 connected to Server
664
+
665
+ Step 2: Connections
666
+ Use Copper Straight-Through cables
667
+ PC1 to Switch Fa0/1
668
+ PC2 to Switch Fa0/2
669
+ Switch to Router G0/0
670
+ Router G0/1 to Server
671
+ All links should be active
672
+
673
+ Step 3: IP Configuration
674
+ PC1 IP 192.168.1.10 Mask 255.255.255.0 Gateway 192.168.1.1 DNS 10.0.0.2
675
+ PC2 IP 192.168.1.30 Mask 255.255.255.0 Gateway 192.168.1.1 DNS 10.0.0.2
676
+ Server IP 10.0.0.2 Mask 255.255.255.0 Gateway 10.0.0.1
677
+
678
+ Step 4: Router Configuration
90
679
  enable
91
680
  configure terminal
92
681
 
93
- interface gigabitEthernet 0/0
682
+ interface g0/0
94
683
  ip address 192.168.1.1 255.255.255.0
95
684
  no shutdown
96
685
  exit
97
686
 
98
- interface serial 0/0/0
99
- ip address 172.16.1.1 255.255.255.252
100
- clock rate 64000
687
+ interface g0/1
688
+ ip address 10.0.0.1 255.255.255.0
101
689
  no shutdown
102
690
  exit
103
- ```
104
691
 
105
- ---
692
+ Step 5: Enable DNS on Server
693
+ Open Server -> Services -> DNS
694
+ Turn DNS ON
695
+ Add entry:
696
+ Name example.com
697
+ Address 10.0.0.2
106
698
 
107
- ## Step 5: Configure Router2
699
+ Step 6: Initial Testing
700
+ From PC1:
701
+ ping 10.0.0.2
702
+ This builds ARP
108
703
 
109
- ```bash
110
- enable
704
+ Then:
705
+ nslookup example.com
706
+ Should work successfully
707
+
708
+ Step 7: Apply ACL Security
111
709
  configure terminal
112
710
 
113
- interface gigabitEthernet 0/0
114
- ip address 10.0.0.1 255.255.255.248
711
+ access-list 101 deny udp host 192.168.1.30 any
712
+ access-list 101 permit ip any any
713
+
714
+ interface g0/0
715
+ ip access-group 101 in
716
+ exit
717
+
718
+ Step 8: Final Testing
719
+ From PC1:
720
+ nslookup example.com
721
+ Should work
722
+
723
+ From PC2:
724
+ nslookup example.com
725
+ Should fail
726
+
727
+ Concepts:
728
+ Router must be in path for ACL to work
729
+ DNS uses UDP port 53
730
+ First ping builds ARP and avoids timeout
731
+ ACL filters traffic based on rules
732
+
733
+ Final Result:
734
+ PC1 allowed
735
+ PC2 blocked
736
+ DNS working
737
+ ACL applied successfully
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+ AIM:
768
+ Simulate a DNS-based UDP hijacking scenario, observe its impact on the client, and apply basic protection.
769
+
770
+ Step 1: Topology Setup
771
+ Connect devices using Copper Straight-Through:
772
+ PC1 to Switch
773
+ PC2 to Switch
774
+ Server to Switch
775
+ Switch to Router
776
+ Ensure all connections are active
777
+
778
+ Step 2: IP Configuration
779
+ PC1 IP 192.168.1.10 Mask 255.255.255.0 Gateway 192.168.1.1 DNS 192.168.1.100
780
+ PC2 IP 192.168.1.20 Gateway 192.168.1.1
781
+ Server IP 192.168.1.100 Gateway 192.168.1.1
782
+
783
+ Step 3: Router Configuration
784
+ enable
785
+ configure terminal
786
+ interface g0/0
787
+ ip address 192.168.1.1 255.255.255.0
115
788
  no shutdown
116
789
  exit
117
790
 
118
- interface serial 0/0/0
119
- ip address 172.16.1.2 255.255.255.252
791
+ Step 4: Enable DNS on Real Server
792
+ Open Server -> Services -> DNS
793
+ Turn DNS ON
794
+ Add entry:
795
+ example.com maps to 192.168.1.100
796
+
797
+ Step 5: Test Normal Output
798
+ From PC1:
799
+ nslookup example.com
800
+ Expected result:
801
+ Name example.com
802
+ Address 192.168.1.100
803
+
804
+ Step 6: Simulate Attack
805
+ Turn OFF real server
806
+ On PC2 change IP to 192.168.1.100
807
+ Enable DNS on PC2
808
+ Add entry:
809
+ example.com maps to 5.5.5.5
810
+
811
+ Step 7: Test Attack Output
812
+ From PC1:
813
+ nslookup example.com
814
+ Expected result:
815
+ Name example.com
816
+ Address 5.5.5.5
817
+
818
+ Observation:
819
+ Before attack DNS resolves to 192.168.1.100
820
+ After attack DNS resolves to 5.5.5.5
821
+ Client is misled
822
+
823
+ Step 8: Apply Basic Protection using Port Security
824
+ On Switch CLI:
825
+ enable
826
+ configure terminal
827
+ interface fa0/2
828
+ switchport mode access
829
+ switchport port-security
830
+ switchport port-security maximum 1
831
+ switchport port-security mac-address sticky
832
+ switchport port-security violation shutdown
833
+ exit
834
+
835
+ Step 9: Final Check
836
+ Attempt attack again
837
+ Port security blocks attacker or shuts down port
838
+
839
+ Output Observation Methods:
840
+ Command Line:
841
+ Use nslookup example.com before and after attack
842
+
843
+ Simulation Mode:
844
+ Select Simulation
845
+ Filter DNS or UDP
846
+ Run nslookup
847
+ Observe source IP, destination IP, and UDP port 53
848
+
849
+ Conclusion:
850
+ DNS over UDP can be exploited by spoofing
851
+ Client blindly trusts DNS response
852
+ Security measures like port security help prevent attacks
853
+
854
+ Result:
855
+ Attack successfully simulated
856
+ Impact observed
857
+ Basic protection applied
858
+
859
+
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
890
+
891
+ AIM:
892
+ Simulate a DoS condition using continuous requests, observe its impact on a server, and apply prevention techniques.
893
+
894
+ Step 1: Topology
895
+ Devices:
896
+ PC1, PC2, PC3, Server connected to Switch
897
+ Switch connected to Router G0/0
898
+ Ensure all connections are active
899
+
900
+ Step 2: IP Configuration
901
+ PC1 IP 192.168.1.10
902
+ PC2 IP 192.168.1.20
903
+ PC3 IP 192.168.1.30
904
+ Server IP 192.168.1.100
905
+ Mask 255.255.255.0
906
+ Gateway 192.168.1.1
907
+
908
+ Step 3: Router Configuration
909
+ enable
910
+ configure terminal
911
+ interface g0/0
912
+ ip address 192.168.1.1 255.255.255.0
120
913
  no shutdown
121
914
  exit
122
- ```
123
915
 
124
- ---
916
+ Step 4: Enable Server Service
917
+ Open Server -> Services -> HTTP
918
+ Turn HTTP ON
125
919
 
126
- ## Step 6: Configure PCs
920
+ Step 5: Normal Test
921
+ From PC1:
922
+ ping 192.168.1.100
923
+ Stable replies indicate normal operation
127
924
 
128
- ### Left network (Router1 side)
925
+ Step 6: Simulate DoS Attack
926
+ From PC2:
927
+ ping 192.168.1.100 -t
129
928
 
130
- * PC1
131
- IP: `192.168.1.2`
132
- Mask: `255.255.255.0`
133
- Gateway: `192.168.1.1`
929
+ From PC3:
930
+ ping 192.168.1.100 -t
134
931
 
135
- * PC2
136
- IP: `192.168.1.3`
137
- Gateway: `192.168.1.1`
932
+ Continuous traffic is generated
138
933
 
139
- ---
934
+ Step 7: Observe Impact
935
+ From PC1:
936
+ ping 192.168.1.100
140
937
 
141
- ### Right network (Router2 side)
938
+ Expected results:
939
+ Request timed out
940
+ High delay
941
+ Packet loss
142
942
 
143
- * PC3
144
- IP: `10.0.0.2`
145
- Mask: `255.255.255.248`
146
- Gateway: `10.0.0.1`
943
+ Indicates server overload and network congestion
147
944
 
148
- * PC4
149
- IP: `10.0.0.3`
150
- Gateway: `10.0.0.1`
945
+ Step 8: Important Concept
946
+ If all devices are in same network, traffic flows directly
947
+ PC -> Switch -> Server
948
+ Router is bypassed
949
+ ACL on router will not work
151
950
 
152
- ---
951
+ Step 9: Apply Switch Port Security
952
+ enable
953
+ configure terminal
153
954
 
154
- ## Step 7: Configure Routing (VERY IMPORTANT)
955
+ interface fa0/2
956
+ switchport port-security
957
+ switchport port-security maximum 1
958
+ switchport port-security violation shutdown
959
+ exit
155
960
 
156
- ### Router1:
961
+ interface fa0/3
962
+ switchport port-security
963
+ switchport port-security maximum 1
964
+ switchport port-security violation shutdown
965
+ exit
966
+
967
+ Limits attacker behavior
968
+
969
+ Step 10: Improved Topology for Router Control
970
+ Change Server network:
971
+ Server IP 10.0.0.2 Gateway 10.0.0.1
972
+
973
+ Add router interface:
974
+ interface g0/1
975
+ ip address 10.0.0.1 255.255.255.0
976
+ no shutdown
977
+
978
+ Traffic now passes through router
979
+
980
+ Step 11: Apply ACL Protection
981
+ ip access-list extended BLOCK_ICMP
982
+ permit icmp host 192.168.1.10 host 10.0.0.2
983
+ deny icmp any any
984
+
985
+ interface g0/0
986
+ ip access-group BLOCK_ICMP in
987
+
988
+ Step 12: Final Testing
989
+ From PC1:
990
+ ping 10.0.0.2 (should work)
991
+
992
+ From PC2 and PC3:
993
+ ping 10.0.0.2 (should fail)
994
+
995
+ Output Observation:
996
+ Command Line:
997
+ Compare ping before and during attack
998
+
999
+ Simulation Mode:
1000
+ Filter ICMP
1001
+ Observe multiple packets and congestion
1002
+
1003
+ Conclusion:
1004
+ DoS attack floods server with requests causing delay and packet loss
1005
+ Switch port security and ACL help control traffic
1006
+
1007
+ Result:
1008
+ Attack simulated
1009
+ Impact observed
1010
+ Protection applied successfully
1011
+
1012
+
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+ 1. Basic Network (OSI Flow)
1043
+ PC
1044
+ ping 192.168.1.2 ++
1045
+
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+
1060
+
1061
+ 2. IPv4 Addressing + Routing
1062
+ Router
1063
+ enable ++
1064
+ configure terminal ++
1065
+
1066
+ interface g0/0 ++
1067
+ ip address 192.168.1.1 255.255.255.0 ++
1068
+ no shutdown ++
1069
+ exit ++
1070
+
1071
+ interface s0/0/0
1072
+ ip address 172.16.1.1 255.255.255.252
1073
+ no shutdown
1074
+ exit
157
1075
 
158
- ```bash
159
1076
  ip route 10.0.0.0 255.255.255.248 172.16.1.2
160
- ```
1077
+ PC
1078
+ ping 10.0.0.2 ++
161
1079
 
162
- ### Router2:
163
1080
 
164
- ```bash
165
- ip route 192.168.1.0 255.255.255.0 172.16.1.1
166
- ```
167
1081
 
168
- ---
169
1082
 
170
- ## Step 8: Verify interfaces
171
1083
 
172
- Run on both routers:
173
1084
 
174
- ```bash
175
- show ip interface brief
176
- ```
177
1085
 
178
- You MUST see:
179
1086
 
180
- ```
181
- up up
182
- ```
183
1087
 
184
- If not:
185
- Use `no shutdown`
186
1088
 
187
- ---
188
1089
 
189
- ## Step 9: Test connectivity
190
1090
 
191
- From PC1:
1091
+ 3. NAT (PAT)
1092
+ Router
1093
+ enable ++
1094
+ configure terminal ++
192
1095
 
193
- ```bash
194
- ping 10.0.0.2
195
- ```
1096
+ interface g0/0 ++
1097
+ ip nat inside
1098
+ exit ++
196
1099
 
197
- Expected:
1100
+ interface g0/1 ++
1101
+ ip nat outside
1102
+ exit ++
198
1103
 
199
- ```
200
- Reply from 10.0.0.2
201
- ```
1104
+ access-list 1 permit 192.168.1.0 0.0.0.255 ++
202
1105
 
203
- ---
1106
+ ip nat inside source list 1 interface g0/1 overload
204
1107
 
205
- ## Step 10: See animation (Simulation Mode)
1108
+ ip route 0.0.0.0 0.0.0.0 203.0.113.2
1109
+ Router (Check)
1110
+ show ip nat translations
1111
+ PC
1112
+ ping 203.0.113.2 ++
206
1113
 
207
- 1. Click **Simulation**
208
- 2. Click **Reset Simulation**
209
- 3. Click **Edit Filters**
210
1114
 
211
- * Select only:
212
1115
 
213
- ```
214
- ARP
215
- ICMP
216
- ```
217
1116
 
218
- ---
219
1117
 
220
- ### Send packet
221
1118
 
222
- * Click **Add Simple PDU (envelope icon)**
223
- * Click **PC1 → PC3**
224
1119
 
225
- ---
226
1120
 
227
- ### Play
228
1121
 
229
- * Click play or ⏭ Capture/Forward
1122
+ 4. IPv4 Packet Analysis
1123
+ Wireshark
1124
+ ip.version == 4
1125
+ PC
1126
+ ping 8.8.8.8 ++
230
1127
 
231
- ---
232
1128
 
233
- ## 👀 What you should see
234
1129
 
235
- Packet flow:
236
1130
 
237
- ```
238
- PC1 → Switch1 → Router1 → Router2 → Switch2 → PC3
239
- ```
240
1131
 
241
- * First ARP (finding MAC)
242
- * Then ICMP (ping)
243
- * All **green ✔**
244
1132
 
245
- ---
246
1133
 
1134
+ 5. Packet Fragmentation
1135
+ PC
1136
+ netsh interface ipv4 show subinterfaces
247
1137
 
1138
+ ping 8.8.8.8 -f -l 1472
1139
+ ping 8.8.8.8 -f -l 2000
1140
+ ping 8.8.8.8 -l 2000
1141
+ Wireshark
1142
+ ip.flags.mf == 1 or ip.frag_offset > 0
248
1143
 
249
1144
 
250
1145
 
1146
+ 6. Network Security (ACL)
1147
+ Router
1148
+ enable ++
1149
+ configure terminal ++
251
1150
 
1151
+ access-list 1 deny 192.168.1.20
1152
+ access-list 1 permit any
252
1153
 
1154
+ interface g0/0 ++
1155
+ ip access-group 1 in
1156
+ exit ++
1157
+ PC
1158
+ ping 192.168.1.10 ++
253
1159
 
254
1160
 
255
1161
 
256
1162
 
1163
+ 7. IP Spoofing Protection
1164
+ Router
1165
+ enable ++
1166
+ configure terminal ++
257
1167
 
1168
+ ip access-list extended ANTI-SPOOF
1169
+ deny ip 192.168.1.0 0.0.0.255 any
1170
+ permit ip any any
258
1171
 
1172
+ interface g0/1
1173
+ ip access-group ANTI-SPOOF in
259
1174
 
1175
+ interface g0/0 ++
260
1176
 
261
1177
 
1178
+ ip verify unicast source reachable-via rx
262
1179
 
263
1180
 
264
1181
 
@@ -272,10 +1189,25 @@ PC1 → Switch1 → Router1 → Router2 → Switch2 → PC3
272
1189
 
273
1190
 
274
1191
 
1192
+ 8. TCP Hijacking (Prevention)
1193
+ Router
1194
+ enable ++
1195
+ configure terminal ++
275
1196
 
1197
+ ip access-list extended BLOCK_TCP
1198
+ deny tcp any any eq 23
1199
+ permit ip any any
276
1200
 
1201
+ interface g0/0 ++
1202
+ ip access-group BLOCK_TCP in
1203
+ 9. UDP Hijacking (DNS)
1204
+ 📍 PC
1205
+ nslookup example.com
1206
+ 📍 Server (DNS setup)
277
1207
 
1208
+ (No CLI, but concept command equivalent)
278
1209
 
1210
+ example.com → 192.168.1.100
279
1211
 
280
1212
 
281
1213
 
@@ -289,57 +1221,33 @@ PC1 → Switch1 → Router1 → Router2 → Switch2 → PC3
289
1221
 
290
1222
 
291
1223
 
292
- Step 1: Setting Up the Topology
293
- 1. Add Devices to the Workspace:
294
- o Drag and drop:
295
- ▪ 1 Router (e.g., 2911 or similar).
296
- ▪ 1 Switch (e.g., 2960).
297
- ▪ 3 PCs (PC-0, PC-1, PC-2).
298
- ▪ 1 Cloud or Server (representing the internet).
299
- Step 2: Assign IP Addresses
300
- For Private Network (PCs and Router Internal Interface)
301
- ● Assign Private IP Addresses to the PCs:
302
- o PC-0: IP Address: 192.168.1.2 | Subnet Mask: 255.255.255.0 | Default Gateway:
303
- 192.168.1.1
304
- o PC-1: IP Address: 192.168.1.3 | Subnet Mask: 255.255.255.0 | Default Gateway:
305
- 192.168.1.1
306
- o PC-2: IP Address: 192.168.1.4 | Subnet Mask: 255.255.255.0 | Default Gateway:
307
- 192.168.1.1
308
- Step 3: Configure Router interface
309
- 1) gig0/0
310
- Router> enable
311
- Router# configure terminal
312
- Router(config)# interface gig0/0
313
- Router(config-if)# ip address 192.168.1.1 255.255.255.0
314
- Router(config-if)# no shutdown
315
- 2) gig0/1
316
- Router(config)# interface gig0/1
317
- Router(config-if)# ip address 203.0.113.1 255.255.255.0
318
- Router(config-if)# no shutdown
319
- 3) Assign an IP Address to the Cloud or Server:
320
- a. Cloud/Server IP Address: 203.0.113.2
321
- b. Subnet Mask: 255.255.255.0
322
- Step 4: Configure NAT on the Router
323
- Define Inside and Outside Interfaces
324
- Router(config)# interface gig0/0
325
- Router(config-if)# ip nat inside
326
- Router(config-if)# exit
327
- Router(config)# interface gig0/1
328
- Router(config-if)# ip nat outside
329
- Router(config-if)# exit
330
- Set Up PAT (Port Address Translation)
331
- Allow multiple private IPs to share one public IP:
332
- Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
333
- Router(config)# ip nat inside source list 1 interface gig0/1 overload
334
- Step 5: Configure Routing
335
- Add a Default Route to direct traffic to the public network
336
- Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
337
- Step 6: Test the Configuration
338
- Test Internet Access from PCs
339
- 1. Open the Command Prompt on any PC.
340
- 2. Ping the external Cloud/Server (e.g., ping 203.0.113.2).
341
- o If successful, NAT is working correctly.
342
- Verify NAT Translations on the Router
343
- On the router CLI, use the following command to see active NAT translations:
344
- Router# show ip nat translations
345
1224
 
1225
+
1226
+ 10. DoS Simulation
1227
+ PC (Attack)
1228
+ ping 192.168.1.100 ++
1229
+ Switch (Protection)
1230
+ enable ++
1231
+ configure terminal ++
1232
+
1233
+ interface fa0/2
1234
+ switchport port-security
1235
+ switchport port-security maximum 1
1236
+ switchport port-security violation shutdown
1237
+
1238
+ interface fa0/3
1239
+ switchport port-security
1240
+ switchport port-security maximum 1
1241
+ switchport port-security violation shutdown
1242
+ MASTER REPEATED COMMAND LIST
1243
+
1244
+ These appear everywhere (VERY IMPORTANT):
1245
+
1246
+ enable ++
1247
+ configure terminal ++
1248
+ interface g0/0 ++
1249
+ no shutdown ++
1250
+ exit ++
1251
+ ping ++
1252
+ access-list ++
1253
+ ip access-group ++