Send an IP route to Null

Asset 44

How to add a Null route in windows

Posted on 22 August 2012 by Beaming Support

Unlike the Linux operating system Windows does not provide a facility to send an IP route to Null.

You can however get a similar result as follows:

Windows XP, Server 2003

From a command prompt (start > run > cmd)

route add X.X.X.X mask Y.Y.Y.Y Z.Z.Z.Z metric 1 -p

Where X.X.X.X and Y.Y.Y.Y is the IP range and subnet mask you wish to Null route and Z.Z.Z.Z is a spare unallocated IP address on your local network. For example, if you wish to Null route the IP address 8.8.8.8 and you have a spare unallocated IP address of 192.168.1.123 on your local area network then you would enter:

route add 8.8.8.8 mask 255.255.255.255 192.168.1.123 metric 1 -p

Windows 7, Server 2008

The best method to Null route is to add a deny statement to the windows firewall for the given IP address range. However, in certain situations you may not be using the Windows Firewall but you can again get a similar result with the following method:

From a command prompt (start > run > cmd)

route add X.X.X.X mask Y.Y.Y.Y Z.Z.Z.Z if 1 -p

Where X.X.X.X and Y.Y.Y.Y is the IP range and subnet mask you wish to Null route and Z.Z.Z.Z is the default gateway of your network card. For example, if you wish to Null route the IP address 8.8.8.8 and your default gateway address is 192.168.1.123 on your local area network then you would enter:

route add 8.8.8.8 mask 255.255.255.255 192.168.1.123 if 1 -p

This works by fooling windows into sending packets via the internal interface, thus when you perform a ping test to the destination IP you have blocked, you will see a “general network failure” message. You cannot use the Windows XP / Server 2003 method as later versions of windows include Dead Gateway Detection that will automatically send traffic via the default gateway when the static route’s gateway is inaccessible. Dead Gateway Detection is similar to an ICMP redirect message but cannot be turned off.

NB: -p instructs windows to make this a persistent static route meaning the routes will be preserved even after a reboot. You can remove a route by using the command route delete IP X.X.X.X where X.X.X.X is the IP address / subnet you wish to delete.

 

We're networking experts

When it comes to private wide area networks and business continuity services, a “set it and leave it” approach just doesn’t cut the mustard.

Avoid internet downtime

IT professionals in UK businesses dealt with 82M hours of internet outages last year.

Sign up for Beaming's monthly email updates & receive news on the latest tech to keep you online, simple shareable advice to help colleagues avoid cyber threats & how-to guides from our experienced tech team.
  • This field is for validation purposes and should be left unchanged.

Related

Get the best of Beaming

Sign up to our monthly email updates on:

  • Easy cyber security advice anyone can follow
  • Research into what businesses are doing with their tech
  • How-to guides to boost productivity and efficiency

  • This field is for validation purposes and should be left unchanged.