1. Tổng quan cơ chế hoạt động của “ip classfull”.
Nếu cơ chế “ip classfull” làm việc dựa trên Major Network (là mạng lớn chưa được chia nhỏ). Theo phương thức phân loại địa chỉ IP thì chúng ta có 3 dải địa chỉ IP chủ đạo thuộc các lớp mạng Class A, Class B, Class C. Dựa vào octet đầu tiên, ta có thể phân biệt các Major Network thuộc các lớp Class A , B , C của địa chỉ IP.
- IP thuộc Major Network A sẽ dao động từ 1.0.0.0/8 tới 127.0.0.0/8
- IP thuộc Major Network B sẽ dao động từ 128.0.0.0/16 tới 191.255.0.0/16
- IP thuộc Major Network C sẽ dao động từ 192.0.0.0/24 tới 223.255.255.0/24
Khi bật cơ chế “ip classfull”, Router sẽ bỏ qua default route mà chỉ sử dụng thông tin định tuyến các mạng cụ thể tương ứng với Major Network trong bảng định tuyến. Nếu Major Network không tồn tại, trong bảng định tuyến, Router lúc này mới sử dụng tới default route.
2. Khảo sát cơ chế hoạt động của “ip classfull”
Cấu hình IP trên các VPC:
Code:
- VPC1: [B]ip 172.16.1.2/24 172.16.1.1[/B] - VPC2: [B]ip 172.16.2.2/24 172.16.2.1[/B] - VPC3: [B]ip 172.16.3.2/24 172.16.3.1[/B]
Code:
[B]hostname R1[/B] [B]interface e0/0[/B] [B]ip address 192.168.12.1 255.255.255.0[/B] [B]no shutdown[/B] [B]exit[/B] [B]interface e0/1[/B] [B]ip address 172.16.1.1 255.255.255.0[/B] [B]no shutdown[/B] [B]exit[/B] [B]line console 0[/B] [B]logging synchronous[/B] [B]exec-timeout 0 0[/B] [B]exit[/B] [B]line vty 0 4[/B] [B]privilege level 15[/B] [B]no login[/B] [B]exit[/B] [B]no ip domain-lookup[/B]
Code:
[B]hostname R2[/B] [B]interface e0/0[/B] [B]ip address 192.168.12.2 255.255.255.0[/B] [B]no shutdown[/B] [B]exit[/B] [B]interface e0/1[/B] [B]ip address 172.16.2.1 255.255.255.0[/B] [B]no shutdown[/B] [B]exit[/B] [B]interface e0/2[/B] [B]ip address 172.16.3.1 255.255.255.0[/B] [B]no shutdown[/B] [B]exit[/B] [B]line console 0[/B] [B]logging synchronous[/B] [B]exec-timeout 0 0[/B] [B]exit[/B] [B]line vty 0 4[/B] [B]privilege level 15[/B] [B]no login[/B] [B]exit[/B] [B]no ip domain-lookup[/B]
Code:
[B]ip route 0.0.0.0 0.0.0.0 192.168.12.2 [/B]
Kiểm tra bảng định tuyến tại R1.
Code:
[B]R1# show ip route[/B] [B]Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP[/B] [B] D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area [/B] [B] N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2[/B] [B] E1 - OSPF external type 1, E2 - OSPF external type 2[/B] [B] i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2[/B] [B] ia - IS-IS inter area, * - candidate default, U - per-user static route[/B] [B] o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP[/B] [B] + - replicated route, % - next hop override[/B] [B]Gateway of last resort is 192.168.12.2 to network 0.0.0.0[/B] [B]S* 0.0.0.0/0 [1/0] via 192.168.12.2[/B] [B]172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 172.16.1.0/24 is directly connected, Ethernet0/1[/B] [B]L 172.16.1.1/32 is directly connected, Ethernet0/1[/B] [B]192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 192.168.12.0/24 is directly connected, Ethernet0/0[/B] [B]L 192.168.12.1/32 is directly connected, Ethernet0/0[/B] [B]R1#[/B]
Code:
[B]R1(config)# ip classless[/B] [B]S* 0.0.0.0/0 [1/0] via 192.168.12.2[/B] [B]R1# ping 172.16.2.2[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:[/B] [B]!!!!![/B] [B]Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms[/B] [B]R1#[/B] [B]R1# ping 172.16.3.2[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:[/B] [B]!!!!![/B] [B]Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms[/B] [B]R1#[/B]
Code:
[B]R1(config)# no ip classless[/B]
Code:
[B]R1(config)# no ip cef[/B]
Code:
[B]R1# ping 172.16.2.1[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:[/B] [B].....[/B] [B]Success rate is 0 percent (0/5)[/B] [B]R1#[/B] [B]R1# ping 172.16.3.1[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds:[/B] [B].....[/B] [B]Success rate is 0 percent (0/5)[/B] [B]R1#[/B] [B]R1# show ip route[/B] [B]Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP[/B] [B] D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area [/B] [B] N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2[/B] [B] E1 - OSPF external type 1, E2 - OSPF external type 2[/B] [B] i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2[/B] [B] ia - IS-IS inter area, * - candidate default, U - per-user static route[/B] [B] o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP[/B] [B] + - replicated route, % - next hop override[/B] [B]Gateway of last resort is 192.168.12.2 to network 0.0.0.0[/B] [B]S* 0.0.0.0/0 [1/0] via 192.168.12.2[/B] [B]172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 172.16.1.0/24 is directly connected, Ethernet0/1[/B] [B]L 172.16.1.1/32 is directly connected, Ethernet0/1[/B] [B]192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 192.168.12.0/24 is directly connected, Ethernet0/0[/B] [B]L 192.168.12.1/32 is directly connected, Ethernet0/0[/B] [B]R1#[/B]
Code:
[B]R1(config)# access-list 100 permit icmp any any[/B] [B]R1# debug ip packet 100[/B] [B]IP packet debugging is on for access list 100[/B] [B]R1#[/B] [B]R1# ping 172.16.2.1[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:[/B] [B]*Jul 16 03:39:02.051: IP: s=172.16.1.1 (local), d=172.16.2.1, len 100, unroutable.[/B] [B]*Jul 16 03:39:04.052: IP: s=172.16.1.1 (local), d=172.16.2.1, len 100, unroutable.[/B] [B]*Jul 16 03:39:06.052: IP: s=172.16.1.1 (local), d=172.16.2.1, len 100, unroutable.[/B] [B]*Jul 16 03:39:08.052: IP: s=172.16.1.1 (local), d=172.16.2.1, len 100, unroutable.[/B] [B]*Jul 16 03:39:10.052: IP: s=172.16.1.1 (local), d=172.16.2.1, len 100, unroutable.[/B] [B]Success rate is 0 percent (0/5)[/B] [B]R1#[/B]
Code:
[B]R1# show ip route [/B] [B]Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP[/B] [B] D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area [/B] [B] N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2[/B] [B] E1 - OSPF external type 1, E2 - OSPF external type 2[/B] [B] i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2[/B] [B] ia - IS-IS inter area, * - candidate default, U - per-user static route[/B] [B] o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP[/B] [B] + - replicated route, % - next hop override[/B] [B]Gateway of last resort is 192.168.12.2 to network 0.0.0.0[/B] [B]S* 0.0.0.0/0 [1/0] via 192.168.12.2[/B] [B]172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 172.16.1.0/24 is directly connected, Ethernet0/1[/B] [B]L 172.16.1.1/32 is directly connected, Ethernet0/1[/B] [B]192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 192.168.12.0/24 is directly connected, Ethernet0/0[/B] [B]L 192.168.12.1/32 is directly connected, Ethernet0/0[/B] [B]R1#[/B] [B]R1(config)# interface e0/1[/B] [B]R1(config-if)# shutdown[/B]
Code:
[B]R1# show ip route[/B] [B]Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP[/B] [B] D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area [/B] [B] N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2[/B] [B] E1 - OSPF external type 1, E2 - OSPF external type 2[/B] [B] i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2[/B] [B] ia - IS-IS inter area, * - candidate default, U - per-user static route[/B] [B] o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP[/B] [B] + - replicated route, % - next hop override[/B] [B]Gateway of last resort is 192.168.12.2 to network 0.0.0.0[/B] [B]S* 0.0.0.0/0 [1/0] via 192.168.12.2[/B] [B]192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks[/B] [B]C 192.168.12.0/24 is directly connected, Ethernet0/0[/B] [B]L 192.168.12.1/32 is directly connected, Ethernet0/0[/B] [B]R1#[/B] [B]R1# ping 172.16.2.2[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:[/B] [B]!!!!![/B] [B]Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms[/B] [B]R1#[/B] [B]R1# ping 172.16.3.2[/B] [B]Type escape sequence to abort.[/B] [B]Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:[/B] [B]!!!!![/B] [B]Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms[/B] [B]R1#[/B]
Bùi Quốc Kỳ