1

The output of netstat -rn on my FreeBSD virtual machine shows that:

Internet:
Destination        Gateway            Flags      Netif Expire
default            10.195.51.254      UGS      vtnet0
10.195.48.0/22     link#1             U        vtnet0
10.195.49.46       link#1             UHS         lo0
127.0.0.1          link#2             UH          lo0
132.148.77.28      link#1             UHS         lo0
132.148.77.28/32   link#1             U        vtnet0

Given the CIDR of 32, doesn't 132.148.77.28/32 equal 132.148.77.28? If so, how do packets to the destination address in question decide whether to use lo0 or vtnet0 since there's two different routes defined for that address?

1

The H flag indicates a route to a particular host, which will be used in preference to a route to a subnet.

It looks like the main subnet for vtnet0 is 10.195.48.0/22, and 132.148.77.28 is just an alias (hence the /32).

See the manual pages for netstat(1) and route(8).

  • Is the Netif column for the interface that the packet is coming from? As in, any packet passing through lo0 bound for 132.148.77.28 will send it to link#1, and any packet passing through vtnet0 bound for 132.148.77.28 will also send it to link#1? OR, are you saying that it doesn't matter where it comes from, the preferred route will always be the one with UHS flags - in which case what would the Netif value do? – user305964 Feb 12 '17 at 2:42
  • A packet arriving on any interface for the host has arrived and doesn't need to be routed anywhere. If you need a deeper understanding of the network interface, you could look at The Design and Implementation of the FreeBSD Operating System (book) – Richard Smith Feb 12 '17 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.