Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 1997 00:16:02 GMT
From:      chris warth <csw@chezmoi.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   using route -interface
Message-ID:  <199702030016.AAA02120@ftp.chezmoi.com>

next in thread | raw e-mail | index | archive | help

Can someone please explain how to use the "-interface" option of the
"route" command?  How do host routes installed via "-interface" differ
from routes learned from using default routes?  

Specifically, I am running this test on 2.1.0-RELEASE and if I try to
use the "-interface" option to force traffic for a particular host out
through an interface, I cannot seem to ever get replies back.  I
understand that this is usually used for ppp interfaces, but why won't
it work for simple ethernet interfaces as well?  Do I need to do
something with proxy-arp?

In the simplest case, I have a machine connected to a single local
ethernet.  Here is the output from "ifconfig -a"

    de0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	    inet 206.26.48.2 netmask 0xffffff00 broadcast 206.26.48.255
    lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 16384
	    inet 127.0.0.1 netmask 0xff000000 

At the beginning my routing table looks like this:

    Routing tables

    Internet:
    Destination      Gateway            Flags     Refs     Use     Netif Expire
    default          206.26.48.1        UGSc       23      410       de0
    127.0.0.1        127.0.0.1          UH          0        7       lo0
    206.26.48        link#2             UC          1        0 
    206.26.48.1      0:c0:7b:0:1f:40    UHLW       12        3       de0    939
    206.26.48.2      0:0:c0:96:9d:db    UHLW        3      241       lo0
    206.26.48.255    link#2             UHLW        1      822 
    224              link#2             UCS         0        0 

206.26.48.1 is my gateway machine.  206.26.48.2 is the machine I am
on.  

If I now delete the route for the gateway machine and replace it with
an explicit -interface route, I can no longer communicate with the
gateway at all.

    # route delete 206.26.48.1
    delete host 206.26.48.1

    # route add 206.26.48.1 -interface 206.26.48.2
    add host 206.26.48.1: gateway 206.26.48.2

Now this should be the same as it was before.  I have just tried to
make explicit what was implied by the subnet mask before, namely, that
206.25.48.1 can be reached via interface de0.  Yet now I cannot reach
206.26.48.1!

    # ping 206.26.48.1
    ^C
    --- 206.26.48.1 ping statistics ---
    12 packets transmitted, 0 packets received, 100% packet loss

    # netstat -rn
    Routing tables

    Internet:
    Destination      Gateway            Flags     Refs     Use     Netif Expire
    default          206.26.48.1        UGSc       17      412       de0
    10.100.100       link#3             UC          1        0 
    127.0.0.1        127.0.0.1          UH          0        7       lo0
    206.26.48        link#2             UC          1        0 
    206.26.48.1      206.26.48.2        UHS         0       12       de0
    206.26.48.2      0:0:c0:96:9d:db    UHLW        3      281       lo0
    206.26.48.255    link#2             UHLW        1      869 
    224              link#2             UCS         0        0 

So I never received any replies to the ping, but the "Use" count for
that route did go up as expected.  So why do the replies not get back?

Again, I am running this test on 2.1.0-RELEASE, but I have also seen
the same behavior on 2.1.5-RELEASE.

Thanks in advance for any help.

-csw




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702030016.AAA02120>