Loopback in Route table

10,656

If your looking to re-create this route:

        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306

Then you have to do this:

route add 127.0.0.1 mask 255.255.255.255 0.0.0.0 metric 306

However, you will notice that the METRIC is never recreated. I have no idea why that is, but it's probably just Windows trying to outsmart the user. You may have better success with using '... METRIC 1'. Also, to re-create On-link, you simply use 0.0.0.0.

Two more things.

(1) When deleting routes, Windows deletes ALL routes on that Network Destination. So they need to be recreated as you noticed.

(2) Sniffing on local loopback interface routes is not well supported in Windows, so you need to make sure loopback routes "exits" the interface first, usually through an external gateway.

Share:
10,656
Gil
Author by

Gil

I am employed by Chevron Corp. as an Application Performance Analyst troubleshooting performance problemns involving enterprise applications. I love to program in C#, but I've programmed in many of the most popular languages. My first programs starting in 1979 were written in Microsoft BASIC on a TRS-80 Model I computer with 4K ROM that mostly contained the code to run BASIC, and 4K RAM. I learned to program on that machine starting with BASIC, and going on to Z80 Assembly Langauge, C, and Pascal.

Updated on June 08, 2022

Comments

  • Gil
    Gil almost 2 years

    I and working on a project to create a WAN emulator using FreeBDS in a VMWare guest configured to route traffic between the host operating system and its normal gateway router. I plan to modify the route table on the host so that it's traffic is redirected correctly and use ipfw in the guest to modify various network characteristics.

    In Windows 7 I can completely clear the route table with "ROUTE -f" but I am unable after that to recreate routes for the loopback address.

    Here is my route table before clearing it with "ROUTE -f":

    ===========================================================================
    Interface List
     10...00 1c c0 ea c9 c2 ......Realtek RTL8168D/8111D Family PCI-E Gigabit
     Ethernet NIC (NDIS 6.20)
     18...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
     20...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
      1...........................Software Loopback Interface 1
     11...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
     12...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
     19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
     21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
    ===========================================================================
    
    IPv4 Route Table
    ===========================================================================
    Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
              0.0.0.0          0.0.0.0    192.168.1.254     192.168.1.68     20
           10.10.10.0    255.255.255.0         On-link        10.10.10.1    276
           10.10.10.1  255.255.255.255         On-link        10.10.10.1    276
         10.10.10.255  255.255.255.255         On-link        10.10.10.1    276
            127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
          192.168.1.0    255.255.255.0         On-link      192.168.1.68    276
         192.168.1.68  255.255.255.255         On-link      192.168.1.68    276
        192.168.1.255  255.255.255.255         On-link      192.168.1.68    276
        192.168.110.0    255.255.255.0         On-link        10.10.10.1    276
        192.168.110.1  255.255.255.255         On-link        10.10.10.1    276
      192.168.110.255  255.255.255.255         On-link        10.10.10.1    276
        192.168.163.0    255.255.255.0         On-link     192.168.163.1    276
        192.168.163.1  255.255.255.255         On-link     192.168.163.1    276
      192.168.163.255  255.255.255.255         On-link     192.168.163.1    276
    ===========================================================================
    Persistent Routes:
      None
    

    After "ROUTE -f" all of the routes below "Active Routes:" disappear on Windows 7. (This does not happen on Vista; there only the default gateway, the top line, disappears.) I have been able to recreate the table for the most part, but I cannot recreate the route for 127.0.0.1. No error message appears, but the help text for ROUTE is displayed.

    Can anyone tell me a manual way to add back the route for the loopback address?