I've a multi-homed windows machine (Windows Server 2016) and I want to make sure that outbound traffic never goes out through secondary network interface (progammatically via C#).
I've 2 default entries for the network interfaces in my routing table:
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 172.31.32.1 172.31.44.180 15
0.0.0.0 0.0.0.0 172.31.96.1 172.31.96.230 15
I think permanently deleting the entry for secondary network interface will be sufficient for my use case. I want only this entry to exist afterwards:
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 172.31.32.1 172.31.44.180 15
I found the C# API DeleteIpForwardEntry
to delete the route, but I do not know how to make this deletion permanent, so that rebooting the machine doesn't undo my change.
Any help will be appreciated.