Loopback in Route table
Asked Answered
S

3

7

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?

Strath answered 5/7, 2012 at 3:14 Comment(1)
+1... I've noticed the same thing. It seems like there ought to be a way to specify "On-link" as the gateway in order to restore the 127.0.0.1 direct route. I haven't found a way yet after much research.Constitutive
A
4

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.

Alphosis answered 31/3, 2014 at 15:48 Comment(1)
Thanks for the reply. It has been a while since I had this problem, and a couple of OSes ago. ;-) But I appreciate the info if I ever needed it again.Strath
R
0

When users are not able to ping 127.0.0.1, one of the troubleshooting steps that we used was netsh winsock reset. It requires reboot of the machine, but it just worked for me.

Rockoon answered 1/7, 2016 at 17:46 Comment(0)
C
0

I think about what the better use this (in *.bat file):

route -p add 127.0.0.1 mask 255.255.255.255 0.0.0.0 metric 1 if 1
route -p add 127.0.0.0 mask 255.0.0.0 0.0.0.0 metric 1 if 1

, and at the same place next command at once:

route -p change 127.0.0.1 mask 255.255.255.255 0.0.0.0 metric 1 if 1
route -p change 127.0.0.0 mask 255.0.0.0 0.0.0.0 metric 1 if 1

, where if 1 - numbe of loopback interface, that is one.

Congenital answered 28/12, 2017 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.