Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Nov 2001 21:21:12 +0200
From:      Ruslan Ermilov <ru@FreeBSD.ORG>
To:        Vlad Skvortsov <vss@smarts-gsm.ru>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: route add <host> -interface
Message-ID:  <20011128212112.B94418@sunbay.com>
In-Reply-To: <20011128191538.O11977@smarts-gsm.ru>
References:  <20011128143913.M11977@smarts-gsm.ru> <20011128140919.A42977@sunbay.com> <20011128191538.O11977@smarts-gsm.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 28, 2001 at 07:15:38PM +0300, Vlad Skvortsov wrote:
> On Wed, Nov 28, 2001 at 02:09:19PM +0200, Ruslan Ermilov wrote:
> 
> 	[Please CC: any answers back to me, I'm not on the list !]
> 
> > >                 Internal router                     Peer
> > >       ===============================            ===========
> > > ----> | 192.168.1.2 | | 192.168.2.1 | -- sbni -> | 2.3.4.1 |
> > >       ===============================            ===========
> > > 
> > > 	ISP forwards a block of addresses, say, 2.3.4.0/30 to 1.2.3.5. Cisco
> > > router forwards them to some internal servers. My task is to forward one
> > > address, 2.3.4.1, to peer.
> > > 	The problem is that I cannot setup internal router to properly
> > > forward this address to peer. Peer cannot set 192.168.2.x address on his end
> > > of sbni interface (windows there ...). So I configure my end this way:
> > > 
> > > 	# ifconfig sbni1 192.168.2.1 netmask 0xffffffff
> > > 	# route add 2.3.4.1 -interface sbni1
> > > 
> > > 	Pinging 2.3.4.1 fails with redirect FROM MY END 192.168.2.1
> > > (redirected to 2.3.4.1). When I start exploring the situation, it reveals
> > > that ARP table contains record with MY MAC address and IP of PEER. When I
> > > see netstat -nr output I discover that there is an entry containing PEER's
> > > ip address and MY ip address (though with proper interface specified).
> > > 
> > > 	Is this a bug in sbni driver or is this a misbehaviour of freebsd
> > > route add command ? I run FreeBSD 4.2.
> > > 
> > So, your purpose is to resolve the 2.3.4.1 address through the ARP on
> > the sbni1 attached ethernet-type network, right?  You can do this in
> > two ways.
> > 
> > 1.  The standard way.
> > Configure your sbni1 interface with netmask other than 255.255.255.255
> > and give the peer an address in the 192.168.2 network, say 192.168.2.2.
> > Then, the following command will DTRT:
> > route add -host 2.3.4.1 192.168.2.2
> 
> 	This can't be accomplished due to peer's configuration. There is
> windows router there and in order to NAT their network they have to set real
> ip (2.3.4.1) on sbni interface. Having eliminated this fact would greatly
> simplify the situation.
> 
> > 2.  A magnician's way.
> > Bring your sbni1 interface up, without even configuring any IP address
> > on it!  Then the following command should DTRT:
> > route add -net 2.3.4.1/32 -iface sbni1 -cloning
> > This tells your kernel that it should resolve 2.3.4.1/32 addresses
> > through the ARP on the sbni1 attached network.
> 
> 	I MUST have some ARP-resolvable address on my end to allow windows
> to route packets to my ip rather than through the interface.
> 
Hmm, so the peer is actually a Windows box?

OK, then just use the route(8) command I showed you, in addition to
configuring your interface with the all-ones netmask.

But beware that you will somehow do the opposite on the peer's side,
i.e. learn it how to resolve 192.168.2.1 through the ARP.

It could probably be done with static ARP somehow.

To do this on a FreeBSD box (configure static ARP entry for a peer),
run this command:

route add -iface -llinfo -host 2.3.4.1 -link sbni1:1.2.3.4.5.6

You can't do this with arp(8), because it needs to "intuit" the
interface index.  Also, you can't use "-ifp sbni1" on FreeBSD < 5.0
with the "route add" command.  On 5.0-CURRENT, you'd write:

route add -iface -llinfo -host 2.3.4.1 -link :1.2.3.4.5.6 -ifp sbni1


<PS>
Please don't exclude me from reply list: if I wanted to be excluded,
I'd have used the Mail-Followup-To: feature.
</PS>

Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

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




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