How to let Windows 10 automatically add LAN route to my route table

5,892

Remove your network and re-add it

Share:
5,892

Related videos on Youtube

Dennis Wong
Author by

Dennis Wong

Updated on September 18, 2022

Comments

  • Dennis Wong
    Dennis Wong over 1 year

    As you may know, if you connect your computer to LAN, you will alwasy automatically get a route like this:

    IPv4 Route Table
    ===========================================================================
    Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
              0.0.0.0          0.0.0.0     xxx.xxx.xx.1   xxx.xxx.xx.222     20
    

    I accidentally deleted this route by this command (4 is my interface number for LAN):

    route delete 0.0.0.0 if 4
    

    Of course this is not cool, so added this route back (without persistent option -p):

    route add 0.0.0.0 mask 0.0.0.0 xxx.xxx.xx.1 metric 20 if 4
    

    Well this brings my problem, every time I restart my computer, I lose this route, but I do NOT want use persistent option (-p) because I believe there should be some automatic method to make LAN route table works, just as it used to.

    So any ideas how could I fix this on Windows 10?

    • ncenerar
      ncenerar over 8 years
      Are you sure the -p option is not the way it used to work ? What is wrong with it ?
    • Dennis Wong
      Dennis Wong about 8 years
      -p works but it's not the default way (ugly), so I wanted a more elegant solution; but well, I just reinstalled Windows (for other reasons) and it's fine now :-D