Nguồn: Sách CCNA Labpro
LAB 3-2: CẤU HÌNH ĐỊNH TUYẾN TĨNH
[C] ----10.0.3.0--- [A] ---10.0.2.0--- [B]
Mô tả và yêu cầu:
- Cấu hình static route trên các router A, router B và router C.
- Router C hoạt động như DCE router, Router A là DTE router.
- Từ các router, ta phải có thể ping được tất cả các địa chỉ trong mạng.
Cấu hình:
Router A:
!
hostname RouterA
no ip domain-lookup
!
interface s0
ip address 10.0.3.2 255.255.255.0
no shutdown
!
interface E0
ip address 10.0.2.2 255.255.255.0
no shutdown
!
end
Router B:hostname RouterA
no ip domain-lookup
!
interface s0
ip address 10.0.3.2 255.255.255.0
no shutdown
!
interface E0
ip address 10.0.2.2 255.255.255.0
no shutdown
!
end
!
hostname RouterB
no ip domain-lookup
!
interface E0
ip address 10.0.2.1 255.255.255.0
no shutdown
!
ip route 10.0.3.0 255.255.255.0 e0
!
end
Router C:hostname RouterB
no ip domain-lookup
!
interface E0
ip address 10.0.2.1 255.255.255.0
no shutdown
!
ip route 10.0.3.0 255.255.255.0 e0
!
end
!
hostname RouterC
no ip domain-lookup
!
interface s0
ip address 10.0.3.100 255.255.255.0
no shutdown
!
ip route 10.0.2.0 255.255.255.0 10.0.3.2
!
end
Các bước thực hiện:hostname RouterC
no ip domain-lookup
!
interface s0
ip address 10.0.3.100 255.255.255.0
no shutdown
!
ip route 10.0.2.0 255.255.255.0 10.0.3.2
!
end
Bước 1: Cấu hình Router A.
RouterA(config)#hostname RouterA
RouterA(config)#no ip domain-lookup
RouterA(config)#interface s0
RouterA(config-if)#ip address 10.0.3.2 255.255.255.0
RouterA(config-if)#no shutdown
Chú ý: Khi thực hiện lệnh no shutdown, sẽ xuất hiện dòng thông báo:RouterA(config)#hostname RouterA
RouterA(config)#no ip domain-lookup
RouterA(config)#interface s0
RouterA(config-if)#ip address 10.0.3.2 255.255.255.0
RouterA(config-if)#no shutdown
01:31:19: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
RouterA(config-if)#interface E0
RouterA(config-if)#ip address 10.0.2.2 255.255.255.0
RouterA(config-if)#no shutdown
01:34:38: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
RouterA(config-if)#end
01:35:39: %SYS-5-CONFIG_I: Configured from console by console
RouterA#
RouterA(config-if)#ip address 10.0.2.2 255.255.255.0
RouterA(config-if)#no shutdown
01:34:38: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
RouterA(config-if)#end
01:35:39: %SYS-5-CONFIG_I: Configured from console by console
RouterA#
Bước 2: Cấu hình Router B.
RouterB(config)#hostname RouterB
RouterB(config)#no ip domain-lookup
RouterB(config-if)#interface e0
RouterB(config-if)#ip address 10.0.2.1 255.255.255.0
RouterB(config-if)#no shut
01:44:38: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
RouterB(config-if)#end
01:45:39: %SYS-5-CONFIG_I: Configured from console by console
RouterB#
RouterB(config)#hostname RouterB
RouterB(config)#no ip domain-lookup
RouterB(config-if)#interface e0
RouterB(config-if)#ip address 10.0.2.1 255.255.255.0
RouterB(config-if)#no shut
01:44:38: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
RouterB(config-if)#end
01:45:39: %SYS-5-CONFIG_I: Configured from console by console
RouterB#
Bước 3: Cấu hình cơ bản Router C.
RouterC(config)#hostname RouterC
RouterC(config)#no ip domain-lookup
RouterC(config)#interface s0
RouterC(config-if)#ip address 10.0.3.100 255.255.255.0
RouterC(config-if)#no shutdown
01:51:19: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
RouterC(config-if)#end
01:51:39: %SYS-5-CONFIG_I: Configured from console by console
RouterC#
Bước 4: Kiểm tra kết nối giữa các Router A, Router B, Router CRouterC(config)#hostname RouterC
RouterC(config)#no ip domain-lookup
RouterC(config)#interface s0
RouterC(config-if)#ip address 10.0.3.100 255.255.255.0
RouterC(config-if)#no shutdown
01:51:19: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
RouterC(config-if)#end
01:51:39: %SYS-5-CONFIG_I: Configured from console by console
RouterC#
RouterC#ping 10.0.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
Chú ý: Nếu không ping được, kiểm tra lại cấu hình bằng lệnh show running-config, show interface để bảo đảm cấu hình đúng, giải quyết sự cố nếu cần.Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterB#ping 10.0.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterB#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterA#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterC#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
RouterB#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
- Trên Router C, xem bảng định tuyến bằng lệnh show ip routeType escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterB#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterA#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterC#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
RouterB#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
RouterC#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
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.3.0 is directly connected, Serial0/0
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
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.3.0 is directly connected, Serial0/0
Bước 5: Cấu hình static routes.
- Tại Router C, cấu hình static route đến Router B:RouterC(config)#ip route 10.0.2.0 255.255.255.0 10.0.3.2
RouterC(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console
Chú ý: Khi cấu hình next hop router là địa chỉ IP thì AD=1; ta cấu hình next hop router sử dụng outgoing interface thì AD =0.RouterC(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console
- Tại Router B, định tuyến static route đến Router C.
RouterB(config)#ip route 10.0.3.0 255.255.255.0 e0
RouterB(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console
- Tại Router C, ping Router B bằng lệnh ping 10.0.2.1RouterB(config)#exit
02:06:37: %SYS-5-CONFIG_I: Configured from console by console
RouterC#ping 10.0.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
- Tại Router B, ping Router C bằng lệnh ping 10.0.3.100Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
RouterB#ping 10.0.3.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/8 ms
- Xem bảng định tuyến trên Router C bằng lệnh show ip route:Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/8 ms
RouterC#show ip route
...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S 10.0.2.0 [1/0] via 10.0.3.2
C 10.0.3.0 is directly connected, Serial0/0
Chú ý: "S" biểu thị cho kết nối static với AD =1 và hop count là 0 [1/0]...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S 10.0.2.0 [1/0] via 10.0.3.2
C 10.0.3.0 is directly connected, Serial0/0
- Xem bảng định tuyến trên router B:
RouterB#show ip route
...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.0.2.0 is directly connected, FastEthernet0/1
S 10.0.3.0 is directly connected, FastEthernet0/1
Chú ý: AD=0 khi ta chọn outgoing interface để cấu hình static route. Ở đây ta không thấy entry [1/0] trong cấu hình.
...
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.0.2.0 is directly connected, FastEthernet0/1
S 10.0.3.0 is directly connected, FastEthernet0/1
Comment