Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2001 17:06:56 -0500
From:      "Steven Ames" <steve@virtual-voodoo.com>
To:        "Matt Dillon" <dillon@earth.backplane.com>
Cc:        "Jonathan M. Slivko" <jslivko@blinx.net>, "Chris Dillon" <cdillon@wolves.k12.mo.us>, <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: Why two cards on the same segment...
Message-ID:  <016401c1161f$4d365c50$28d90c42@eservoffice.com>
References:  <Pine.BSF.4.32.0107261528390.2406-100000@mail.wolves.k12.mo.us> <001701c11614$94114000$6401a8c0@equinox> <00fa01c11615$73cccb10$28d90c42@eservoffice.com> <003401c11616$d2a8e460$6401a8c0@equinox> <011d01c11617$10b96950$28d90c42@eservoffice.com> <200107262136.f6QLaCX62360@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>     If you have one interface with *two* ip addresses.  For example
(taking
>     a real life example):
>
> ash:/home/dillon> ifconfig
> fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         inet 208.161.114.66 netmask 0xffffffc0 broadcast 208.161.114.127
>         inet 10.0.0.3 netmask 0xffffff00 broadcast 10.0.0.255
>         ether 00:b0:d0:49:3b:fd
>         media: Ethernet autoselect (100baseTX <full-duplex>)
>         status: active
>
>     Then the 'source IP' address the machine uses is completely up in the
>     air.   It could be the external IP, or the internal IP, and it could
>     change out from under you if you manipulate the interface with
ifconfig.

? For real? If you telnet from your machine to some other machine in the
world (mine for instance) your source address could either be
208.161.114.66 (which would work) or 10.0.0.3 (which wouldn't
work because my server would have no clue how to send packets
back)?

traceroutes from your machine fail half the time because your next hop
(the external default gateway) doesn't know how to respond to
packets with a source address of 10.0.0.3 either?

To test that theory I just bound 10.0.0.3/24 to my external interface and
initiated some ssh from my server to my office server. In every case it
used the public address (not sure why, either because its the 'real' (i.e.
non-alias interface) or because that's the IP in the subnet as the gateway).

ifconfig ed0 inet 10.0.0.3 netmask 0xffffff00 alias

ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 204.120.165.254 netmask 0xfffffffc broadcast 204.120.165.255
        inet 10.0.0.3 netmask 0xffffff00 broadcast 10.0.0.255
        ether 52:54:00:dc:08:ca

And it works just fine. The source address is always the public IP. The
gateway is 204.120.165.253.
I cannot believe its random. On the other hand (haven't tried this in FBSD,
but in Solaris it works),
if you assign an interface like this:

ifconfig ed0 inet 204.120.165.1 netmask 0xffffff00
ifconfig ed0 inet 204.120.165.2 netmask 0xffffff00

It will randomly choose one of those addresses (assuming a gateway within
that subnet).

-Steve


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?016401c1161f$4d365c50$28d90c42>