-Một dạng định tuyến tĩnh thường gặp là default-route, thường dùng cho stub-network khi cấu hình cho router ra internet.
Câu lệnh:
IP ROUTE <network destination and subnet mask > <outgoing interface or remote router>
- network destination and subnet mask – specifies a range of IP addresses.
- remote router – IP address of the router used to reach that network.
- outgoing interface – outgoing interface the packet should go out to reach the destination network.
Xây dựng đồ hình.
Yêu cầu, PC1 ping thông đến PC2
Cấu hình router R1,
-----Ip cho interface f0/0
R1(config)#int f0/0
R1(config-if)#ip add 20.20.0.2 255.255.255.0
R1(config-if)#no shut
----ip cho interface f1/0
R1(config-if)#int f1/0
R1(config-if)#ip add 192.168.0.2 255.255.255.0
R1(config-if)#no shut
---Thêm route đến mạng 10.10.0.0
R1(config)#ip route 10.10.0.0 255.255.255.0 192.168.1.1
R1(config)#do wr
-------ip trên interface f0/0
R2(config)#int f0/0
R2(config-if)#ip add 10.10.0.1 255.255.255.0
R2(config-if)#no shut
------ip trên interface f1/0
R2(config-if)#int f1/0
R2(config-if)#ip add 192.168.0.1 255.255.255.0
R2(config-if)#no shut
-----Thêm route đến mạng 20.20.0.0
R2(config)#ip route 20.20.0.0 255.255.255.0 192.168.0.2
R2(config)#do wr
Trên PC1, và PC2 đặt IP
PC-1> ip 10.10.0.2/24 10.10.0.1
PC-1> save
PC-2> ip 20.20.0.2/24 20.20.0.1
PC-2> save
Kiểm tra bảng định tuyến
R1#sh ip route
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
S 10.10.0.0 [1/0] via 192.168.0.1
20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 20.20.0.0/24 is directly connected, FastEthernet0/0
L 20.20.0.1/32 is directly connected, FastEthernet0/0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, FastEthernet1/0
L 192.168.0.2/32 is directly connected, FastEthernet1/0
R1#sh ip route
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
S 10.10.0.0 [1/0] via 192.168.0.1
20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 20.20.0.0/24 is directly connected, FastEthernet0/0
L 20.20.0.1/32 is directly connected, FastEthernet0/0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, FastEthernet1/0
L 192.168.0.2/32 is directly connected, FastEthernet1/0
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.0.0/24 is directly connected, FastEthernet0/0
L 10.10.0.1/32 is directly connected, FastEthernet0/0
20.0.0.0/24 is subnetted, 1 subnets
S 20.20.0.0 [1/0] via 192.168.0.2
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, FastEthernet1/0
L 192.168.0.1/32 is directly connected, FastEthernet1/0
Kiểm tra ping giữa PC1 và PC2
PC-1> ping 20.20.0.2
84 bytes from 20.20.0.2 icmp_seq=1 ttl=62 time=29.001 ms
84 bytes from 20.20.0.2 icmp_seq=2 ttl=62 time=29.001 ms
84 bytes from 20.20.0.2 icmp_seq=3 ttl=62 time=29.001 ms
84 bytes from 20.20.0.2 icmp_seq=4 ttl=62 time=29.002 ms
84 bytes from 20.20.0.2 icmp_seq=5 ttl=62 time=29.002 ms
PC-2> ping 10.10.0.2
84 bytes from 10.10.0.2 icmp_seq=1 ttl=62 time=23.001 ms
84 bytes from 10.10.0.2 icmp_seq=2 ttl=62 time=29.002 ms
84 bytes from 10.10.0.2 icmp_seq=3 ttl=62 time=29.002 ms
84 bytes from 10.10.0.2 icmp_seq=4 ttl=62 time=29.002 ms
84 bytes from 10.10.0.2 icmp_seq=5 ttl=62 time=29.002 ms
Ta có thể debug bằng câu lệnh debug ip packet
R2#debug ip packet
IP packet debugging is on
R2#ping 10.10.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/12 ms
*Dec 24 09:26:47.767: IP: tableid=0, s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), routed via FIB
*Dec 24 09:26:47.767: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), le n 100, sending
*Dec 24 09:26:47.767: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), le n 100, sending full packet
*Dec 24 09:26:47.771: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, input feature, MCI Check(92), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSE
*Dec 24 09:26:47.771: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, rcvd 2
*Dec 24 09:26:47.775: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, stop process pak for forus packet
*Dec 24 09:26:47.775: IP: tableid=0, s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), routed via FIB
*Dec 24 09:26:47.775: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len 100, sending
*Dec 24 09:26:47.775: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), le n 100, sending full packet
*Dec 24 09
:26:47.783: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, input feature, MCI Check(92), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSE
*Dec 24 09:26:47.783: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, rcvd 2
*Dec 24 09:26:47.783: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, stop process pak for forus packet
*Dec 24 09:26:47.783: IP: tableid=0, s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), routed via FIB
*Dec 24 09:26:47.783: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len 100, sending
*Dec 24 09:26:47.783: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len 100, sending full packet
*Dec 24 09:26:47.791: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, input feature, MCI Check(92), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSE
*Dec 24 09:26:47.791: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, rcvd 2
*Dec 24 09:26:47.791: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, stop process pak for forus packet
*Dec 24 09:26:47.791: IP: tableid=0, s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), routed via FIB
*Dec 24 09:26:47.795: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len 100, sending
*Dec 24 09:26:47.795: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), le n 100, sending full packet
*Dec 24 09:26:47.803: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, input feature, MCI Check(92), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSE
*Dec 24 09:26:47.803: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, rcvd 2
*Dec 24 09:26:47.803: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, stop process pak for forus packet
*Dec 24 09:26:47.803: IP: tableid=0, s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), routed via FIB
*Dec 24 09:26:47.803: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len 100, sending
*Dec 24 09:26:47.803: IP: s=10.10.0.1 (local), d=10.10.0.2 (FastEthernet0/0), len100, sending full packet
*Dec 24 09:26:47.811: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, ipe 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSE*Dec 24 09:26:47.811: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, r*Dec 24 09:26:47.811: IP: s=10.10.0.2 (FastEthernet0/0), d=10.10.0.1, len 100, s
No comments:
Post a Comment