Công cụ Internet - Hướng dẫn cài đặt cấu hình định tuyến tĩnh trên Router Cisco | VN-Zoom | Cộng đồng Chia Sẻ Kiến Thức Công Nghệ và Phần Mềm Máy Tính

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We need money to operate the site, and almost all of it comes from our online advertising.

If possible, please support us by clicking on the advertisements.

Please add vn-z.vn to your ad blocking whitelist or disable your adblocking software.

×

Công cụ Internet Hướng dẫn cài đặt cấu hình định tuyến tĩnh trên Router Cisco

Định tuyến tĩnh là quá trình router thực hiện chuyển gói dữ liệu tới địa chỉ mạng đích dựa vào địa chỉ IP đích của gói dữ liệu. Để chuyển được gói dữ liệu đến đúng đích thì router phải học thông tin về đường đi tới các mạng khác. Bài chia sẻ dưới đây sẽ hướng dẫn tới bạn đọc về cách cài đặt cấu hình định tuyến tĩnh trên Router Cisco một cách dễ dàng.

I. Yêu cầu bài Lab


1. Chuẩn bị sơ đồ mạng
2. Cấu hình các thông số cơ bản cho router


  • Cấu hình hostname cho router
  • Tắt cơ chế phân giải tên miền của router
  • Cấu hình các password cho router
  • Enable password: ccna
  • Enable secret: ccnp
  • Console password: cisco
  • Telnet password: telnet
3. Cấu hình địa chỉ IP cho các thiết bị như bảng mô tả địa chỉ bên trên
4. Kiểm tra cấu hình ban đầu
5. Test kết nối
6. Cấu hình static routing cho các đường mạng trong sơ đồ thông nhau
7. Cấu hình static default route để cho các máy trong mạng Lan có thể ra internet. Giả sử trên router R3có một kết nối ra internet tại cổng fastethernet0/1.
8. Cấu hình static summary route


II. Hướng dẫn
1. Kết nối cáp cho các thiết bị như sơ đồ bên trên
2. Xóa cấu hình cho các thiết bị và reload
3. Cấu hình các thông số cơ bản cho các router
4. Cấu hình địa chỉ ip cho các thiết bị

  • Trên router R1:
+ Đặt địa chỉ và kích hoạt interface fastethernet 0/0

Code:

R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 172.16.3.1 255.255.255.0
R1(config-if)#no shutdown
*Mar 1 01:16:08.212: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 01:16:09.214: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,changed state to up
R1(config-if)#


+ Đặt địa chỉ và kích hoạt interface serial 0/0/0


Code:

R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface Serial 0/0/0
R1(config-if)#ip address 172.16.2.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#clock rate 64000

  • Trên router R2:
+ Đặt địa chỉ và kích hoạt interface fastethernet 0/0

Code:

R2(config)#interface fastethernet 0/0
R2(config-if)#ip address 172.16.1.1 255.255.255.0
R2(config-if)#no shutdown
*Mar 1 01:16:08.212: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 01:16:09.214: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#



+ Đặt địa chỉ và kích hoạt interface serial 0/0/0

Code:

R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface Serial 0/0/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown

+ Đặt địa chỉ và kích hoạt interface serial 0/0/1

Code:

R2(config)#interface Serial 0/0/1
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown

  • Trên router R3:

+ Đặt địa chỉ và kích hoạt interface fastethernet 0/0

Code:

R3(config)#interface fastethernet 0/0
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no shutdown
*Mar 1 01:16:08.212: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 01:16:09.214: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#



+ Đặt địa chỉ và kích hoạt interface serial 0/0/1

Code:

R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#interface Serial 0/0/1
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config-if)#no shutdown
  • Trên PC1:
Ip address: 172.16.3.10
Subnet mask: 255.255.255.0
Default gateway: 172.16.3.1

  • Trên PC2:
Ip address: 172.16.1.10
Subnet mask: 255.255.255.0
Default gateway: 172.16.1.1

  • Trên PC3:
Ip address: 192.168.2.10
Subnet mask: 255.255.255.0
Default gateway: 192.168.2.1
5. Kiểm tra cấu hình ban đầu

  • Kiểm tra trạng thái của các interface

Router R1

Code:

R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.3.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 172.16.2.1 YES manual up up
Serial0/0/1 unassigned YES manual up up
Vlan1 unassigned YES manual administratively down down


Router R2

Code:

R2#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.1.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 172.16.2.2 YES manual up up
Serial0/0/1 192.168.1.2 YES manual up up
Vlan1 unassigned YES manual administratively down down


Router R3

Code:

R3#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.2.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 unassigned YES manual up up
Serial0/0/1 192.168.1.1 YES manual up up
Vlan1 unassigned YES manual administratively down down

  • Kiểm tra bảng định tuyến của 3 router
Router R1

Code:

R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0/0/0
C 172.16.3.0 is directly connected, FastEthernet0/0




Router R2


Code:

R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, Serial0/0/0
C 192.168.1.0/24 is directly connected, Serial0/0/1




Router R3



Code:

R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

C 192.168.1.0/24 is directly connected, Serial0/0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0




6. Test kết nối

  • Trên PC1: ping đến địa chỉ IP trên interface fastethernet 0/0 của router R1: thành công
  • Trên router R1: ping đến địa chỉ IP trên interface serial 0/0/0 của router R2: thành công
  • Trên PC2: ping đến địa chỉ IP trên interface fastethernet 0/0 của router R2: thành công
  • Trên router R2: ping đến địa chỉ IP trên interface serial 0/0/1 của router R3: thành công
  • Trên PC3: ping đến địa chỉ IP trên interface fastethernet 0/0 của router R3: thành công

7. Cấu hình static routing trên các router

  • Command cấu hình static route sử dụng ip next hop:
Code:

Router(config)# ip route network-address subnet-mask ip-address
  • Cấu hình trên router R1:
Code:

R1(config)#ip route 172.16.1.0 255.255.255.0 172.16.2.2
R1(config)#ip route 192.168.1.0 255.255.255.0 172.16.2.2
R1(config)#ip route 192.168.2.0 255.255.255.0 172.16.2.2
  • Cấu hình trên router R2:
Code:

R2(config)#ip route 172.16.3.0 255.255.255.0 172.16.2.1
R2(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.1
  • Cấu hình trên router R3:
Code:

R3(config)#ip route 172.16.3.0 255.255.255.0 192.168.1.2
R3(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)#ip route 172.16.2.0 255.255.255.0 192.168.1.2
  • Kiểm tra kết quả định tuyến



Code:

R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
C 172.16.3.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, Serial0/0/0
S 172.16.1.0 [1/0] via 172.16.2.2
S 192.168.1.0/24 [1/0] via 172.16.2.2
S 192.168.2.0/24 [2/0] via 172.16.2.2
R1#
----------------------------------------------





Code:

R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, Serial0/0/0
S 172.16.3.0 [1/0] via 172.16.2.1
C 192.168.1.0/24 is directly connected, Serial0/0/1
S 192.168.2.0/24 [1/0] via 192.168.1.1
R2#
-----------------------------





Code:

R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
S 172.16.1.0 [1/0] via 192.168.1.2
S 172.16.2.0 [1/0] via 192.168.1.2
S
172.16.3.0 [2/0] via 192.168.1.2
C 192.168.1.0/24 is directly connected, Serial0/0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R3#Command cấu hình static route sử dụng exit interface:
Code:
Router(config)# ip route network-address subnet-mask exit-interface
  • Xóa cấu hình định tuyến trên router R3
Code:

R3(config)#no ip route 172.16.3.0 255.255.255.0 192.168.1.2
R3(config)#no ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)#no ip route 172.16.2.0 255.255.255.0 192.168.1.2
  • Cấu hình định tuyến lại cho R3 sử dụng exit interface
Code:

R3(config)#ip route 172.16.3.0 255.255.255.0 serial 0/0/1
R3(config)#ip route 172.16.1.0 255.255.255.0 serial 0/0/1
R3(config)#ip route 172.16.2.0 255.255.255.0 serial 0/0/1
  • Kiểm tra kết quả định tuyến
Code:

R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
S 172.16.1.0 is directly connected, Serial0/0/1
S 172.16.2.0 is directly connected, Serial0/0/1
S 172.16.3.0 is directly connected, Serial0/0/1
C 192.168.1.0/24 is directly connected, Serial0/0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R3#
8.





Cấu hình static default route cho các router

  • Command cấu hình static default route:
Code:

Router(config)#ip route 0.0.0.0 0.0.0.0 { ip-address | interface }
  • Cấu hình cho router R1:
Code:

R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.2.2
  • Cấu hình cho rouer R2:
Code:

R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
  • Cấu hình cho router R3:
Code:

R3(config)#ip route 0.0.0.0 0.0.0.0 Fastethernet0/1
  • Kiểm tra bảng định tuyến của các router
Code:

R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is 172.16.2.2 to network 0.0.0.0

172.16.0.0/24 is subnetted, 3 subnets
C 172.16.3.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, Serial0/0/0
S 172.16.1.0 [1/0] via 172.16.2.2
S 192.168.1.0/24 [1/0] via 172.16.2.2
S 192.168.2.0/24 [2/0] via 172.16.2.2
S* 0.0.0.0/0 [1/0] via 172.16.2.2
R1#
--------------------------------------




Code:

R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is 192.168.1.1 to network 0.0.0.0

172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, Serial0/0/0
S 172.16.3.0 [1/0] via 172.16.2.1
C 192.168.1.0/24 is directly connected, Serial0/0/1
S 192.168.2.0/24 [1/0] via 192.168.1.1
S* 0.0.0.0/0 [1/0] via 192.168.1.1
R2#
----------------------------------------



Code:

R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

172.16.0.0/24 is subnetted, 3 subnets
S 172.16.1.0 [1/0] via 192.168.1.2
S 172.16.2.0 [1/0] via 192.168.1.2
S 172.16.3.0 [2/0] via 192.168.1.2
C 192.168.1.0/24 is directly connected, Serial0/0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 is directly connected, FastEthernet0/1
R3#
9.





Cấu hình summary route

  • Tiến hành summary ba đường mạng bằng tay
172.16.1.0 10101100.00010000.00000001.00000000
172.16.2.0 10101100.00010000.00000010.00000000
172.16.3.0 10101100.00010000.00000011.00000000

=> Đường mạng summary được là: 172.16.0.0/22

  • Cấu hình static summary route cho router R3
  • Xóa cấu hình định tuyến đang có trên router R3
Code:

R3(config)#no ip route 172.16.3.0 255.255.255.0 192.168.1.2
R3(config)#no ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)#no ip route 172.16.2.0 255.255.255.0 192.168.1.2

  • Cấu hình một đường static summary route trên router R3
Code:

R3(config)#ip route 172.16.0.0 255.255.252.0 192.168.1.2

  • Kiểm tra bảng định tuyến của router R3
Code:

R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o – ODR

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

172.16.0.0/22 is subnetted, 1 subnets
S 172.16.0.0 [1/0] via 192.168.1.2
C 192.168.1.0/24 is directly connected, Serial0/0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 is directly connected, FastEthernet0/1
R3#
  • Test kết nối:
+ Ping từ PC3 đến PC1: thành công
+ Ping từ PC3 đến PC2: thành công
10. Dùng lệnh show running-config để kiểm tra cấu hình các router.

Code:

R1#show running-config
R2#show running-config
R3#show running-config
Hi vọng những chia sẻ phía trên sẽ hỗ trợ cho các bạn cái đặt cấu hình định tuyến tĩnh trên Router Cisco[/URL] một cách dễ dàng và hiệu quả!
 
Sửa lần cuối bởi điều hành viên:


Top