Fullname: Huỳnh Gia Hân
Student ID: 23110019
LAB #06: ROUTING
Đề:
Router hiện ko có đường đi từ 192… sang 172…nhiệm vụ là add đường đi tĩnh cho bảng định
tuyến, sao cho đi được từ mạng 192 sang 172
Cú pháp gợi ý là ip route add
Cuối cùng là máy [Link] ping gói tin được sang [Link] kia là hoàn thành.
Setup môi trường:
- Mở docker -> run
- cd Networking-Essentials\Routing
- thiết lập các container: docker compose up -d
- attach từng máy (4 terminal) cd -> docker exec:
+ docker exec -it host-[Link]
+ docker exec -it router-r1 sh -l
+...
Setup cụ thể:
Trên máy [Link]: ip route add [Link]/24 via [Link]
Trên router r1: ip route add [Link]/24 via [Link]
Trên router r2: ip route add [Link]/24 via [Link]
Trên máy [Link]: ip route add [Link]/24 via [Link]
Sau khi cấu hình, kiểm tra bằng các lệnh sau theo thứ tự:
1. Trên máy [Link]: tcpdump -i eth0 icmp and host [Link] -c 4 -w capt
[Link]
-> xong lệnh để bắt đầu chờ (ví dụ bắt 4 gói)
2. Trên máy [Link]: mới bắt đầu ping [Link]
-> chờ một chút rồi Ctrl + C
=> Qua máy [Link] thì thấy đã bắt được 4 gói, rồi làm ngược lại
host-[Link]
Microsoft Windows [Version 10.0.26100.3476]
(c) Microsoft Corporation. All rights reserved.
C:\Users\huynh>cd Networking-Essentials\Routing
C:\Users\huynh\Networking-Essentials\Routing>docker compose up -d
time="2025-03-20T08:27:18+07:00" level=warning msg="C:\\Users\\huynh\\
Networking-Essentials\\Routing\\[Link]: the attribute `version` is obsolete,
it will be ignored, please remove it to avoid potential confusion"
time="2025-03-20T08:27:18+07:00" level=warning msg="a network with name net-
[Link] exists but was not created for project \"routing\".\nSet `external: true` to use
an existing network"
[+] Running 4/4
✔ Container host-[Link] Started
0.4s
✔ Container router-r1 Started 1.1s
✔ Container router-r2 Started 1.1s
✔ Container host-[Link] Started
0.8s
C:\Users\huynh\Networking-Essentials\Routing>docker exec -it host-[Link]
sh -l
72e04b3f42a7:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
72e04b3f42a7:/# ping [Link]
PING [Link] ([Link]): 56 data bytes
^C
--- [Link] ping statistics ---
154 packets transmitted, 0 packets received, 100% packet loss
72e04b3f42a7:/# ip route add [Link]/24 via [Link]
72e04b3f42a7:/# ping [Link]
PING [Link] ([Link]): 56 data bytes
64 bytes from [Link]: seq=0 ttl=62 time=0.440 ms
64 bytes from [Link]: seq=1 ttl=62 time=0.144 ms
64 bytes from [Link]: seq=2 ttl=62 time=0.128 ms
64 bytes from [Link]: seq=3 ttl=62 time=0.164 ms
64 bytes from [Link]: seq=4 ttl=62 time=0.188 ms
64 bytes from [Link]: seq=5 ttl=62 time=0.142 ms
^C
--- [Link] ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.128/0.201/0.440 ms
72e04b3f42a7:/#
host-[Link]
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements!
[Link]
PS C:\Users\huynh> cd Networking-Essentials\Routing
PS C:\Users\huynh\Networking-Essentials\Routing> docker exec -it host-[Link] sh
-l
a672288ea50f:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth0
a672288ea50f:/# ip route add [Link]/24 via [Link]
a672288ea50f:/# tcpdump -i eth0 icmp and host [Link] -c 4 -w capt
[Link]
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
4 packets captured
4 packets received by filter
0 packets dropped by kernel
a672288ea50f:/#
Router-r1
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements!
[Link]
PS C:\Users\huynh> cd Networking-Essentials\Routing
PS C:\Users\huynh\Networking-Essentials\Routing> docker exec -it router-r1 sh -l
eefbbf4343e5:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth1
eefbbf4343e5:/# ip route add [Link]/24 via [Link]
eefbbf4343e5:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth0
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth1
eefbbf4343e5:/#
Router-r2
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements!
[Link]
PS C:\Users\huynh> cd Networking-Essentials\Routing
PS C:\Users\huynh\Networking-Essentials\Routing> docker exec -it router-r2 sh -l
ca566ad8ce52:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth1
ca566ad8ce52:/# ip route add [Link]/24 via [Link]
ca566ad8ce52:/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[Link] [Link] [Link] UG 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth0
[Link] [Link] [Link] U 0 0 0 eth1
[Link] [Link] [Link] UG 0 0 0 eth0
ca566ad8ce52:/#