How to delete a subnet from bigger subnet route delete PowerShell Windows?

seedphase

New Member
Hi,

This is route print output:
Code:
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1     192.168.1.50     55
          0.0.0.0        128.0.0.0   192.168.10.252    192.168.10.96    257
        128.0.0.0        128.0.0.0   192.168.10.252    192.168.10.96    257
          1.1.1.1    255.255.255.0      192.168.1.1     192.168.1.50    56
      185.1.1.1.1  255.255.255.255      192.168.1.1     192.168.1.50    311
     192.168.10.0    255.255.255.0         On-link     192.168.10.96    257
    192.168.10.96  255.255.255.255         On-link     192.168.10.96    257
   192.168.10.255  255.255.255.255         On-link     192.168.10.96    257
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
     1.1.1.1         255.255.255.0      192.168.1.1       1
===========================================================================
As you see, 1.1.1.1/24 is added in routing table.
I want to delete a subnet (like /32 or bigger) from this but I get error:
Code:
route delete -p 1.1.1.10/32 192.168.1.1
route delete -p 1.1.1.0/25 192.168.1.1
Error:
The route deletion failed: Element not found.
I know I can remove the whole /24 subnet and then use a Python script to generate the desired subnets, but my question is whether it's possible to remove a smaller subnet in routing table.
Windows 10, PowerShell version is 5.1 (18200).
 
Top