Hà Nội: NTT03, Line 1, Thống Nhất Complex, 82 Nguyễn Tuân, Thanh Xuân, Hà Nội. ● HCM: Số 31B, Đường 1, Phường An Phú, Quận 2 (Thủ Đức), TP HCM. ===> Đơn Vị Hàng Đầu Trong Lĩnh Vực Cung Cấp Thiết Bị Security - Network - Wifi - CCTV - Conference - Máy chủ Server - Lưu trữ Storge.
Danh mục sản phẩm

Configure a Static Route with the Null0 Interface

Network Requirements

  • On Device1 and Device2, configure a default static route respectively, and configure the gateway addresses to the peer interface addresses of the two devices. On Device1, configure a static with the Null0 interface to filter only data that is sent to PC2.

Network Topology

Networking for Configuring a Static Route with the Null0 Interface

Figure 3-3 Networking for Configuring a Static Route with the Null0 Interface

Configuration Steps

Step 1: Create VLANs, and add ports to the required VLANs. (Omitted)

Step 2: Configure IP addresses for the ports. (Omitted)

Step 3: Configure static routes.

#Configure Device1.

Device1#configure terminal
Device1(config)#ip route 0.0.0.0 0.0.0.0 50.1.1.2

#Configure Device2.

Device2#configure terminal
Device2(config)#ip route 0.0.0.0 0.0.0.0 50.1.1.1

#On PC1, use the ping command to check the connectivity with PC2.

C:\Documents and Settings\Administrator>ping 100.1.1.2 
 
Pinging 100.1.1.2 with 32 bytes of data: 
 
Reply from 100.1.1.2: bytes=32 time<1ms TTL=126
Reply from 100.1.1.2: bytes=32 time<1ms TTL=126
Reply from 100.1.1.2: bytes=32 time<1ms TTL=126
Reply from 100.1.1.2: bytes=32 time<1ms TTL=126 
 
Ping statistics for 100.1.1.2: 
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: 
Minimum = 0ms, Maximum = 0ms, Average = 0ms 

Step 4: Configure a static route with the Null0 interface.

#Configure Device1.

Device1(config)#ip route 100.1.1.2 255.255.255.255 null0

Step 5: Check the result.

#Query the routing table of Device1.

Device1#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS  
 
Gateway of last resort is 50.1.1.2 to network 0.0.0.0 
 
S 0.0.0.0/0 [1/100] via 50.1.1.2, 00:07:28, vlan2 
C 50.1.1.0/24 is directly connected, 00:07:34, vlan2
C 110.1.1.0/24 is directly connected, 00:00:08, vlan3
C 127.0.0.0/8 is directly connected, 11:46:35, lo0 
S 100.1.1.2/32 [1/1] is directly connected, 00:02:31, null0 

In the routing table, the static route with the Null0 interface has been added.

#On PC1, use the ping command to check the connectivity with PC2.

C:\Documents and Settings\Administrator>ping 100.1.1.2 
 
Pinging 100.1.1.2 with 32 bytes of data: 
 
Request timed out. Request timed out. Request timed out. Request timed out. 
 
Ping statistics for 100.1.1.2: 
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss) 

The ICMP packets sent by PC1 are found to be targeted at interface Null0 according to the routing table in Device1; therefore, the packets are discarded. In this way, PC1 fails to communicate with PC2.

note


  • A static route with the Null0 interface is a special route. The packets sent to the Null0 interface will be discarded. Therefore, configuring a route with the Null0 interface implements packet filtration.