问题原文
原帖链接 · user330198 · CC BY-SA 3.0
How can I null route a IP range? I get a parameter is incorrect error.
route -p ADD 65.55.223.0-65.55.223.255 MASK 255.255.255.255 0.0.0.0
The route addition failed: The parameter is incorrect.
已采纳解答
原帖链接 · Diamond · CC BY-SA 3.0
Your route command syntax is wrong. Here is the proper syntax:
Syntax
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
Destination : Specifies the network destination of the route. The destination can be an IP network address (where the host bits of the network address are set to 0), an IP address for a host route, or 0.0.0.0 for the default route.
As you can see, the command doesn't allow adding ip range like that, and that's why you are getting the error. You need to define the range using network & netmask.
Null route doesn't necessarily means Routing to 0.0.0.0 it means actually Routing to nowhere or blackholing so that the packets are silently dropped.
You may try the following, where if 1 stands for the loopback Interface:
route -p add 65.55.223.0 mask 255.255.255.0 Gateway_ip if 1
Alternatively, you can achieve similar result by pointing the gateway to an unused ip or a fake ip:
route -p add 65.55.223.0 mask 255.255.255.0 unused_ip_address
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
