Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 2020 00:15:20 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Abelenda Diego <diego.abelenda@gmail.com>, freebsd-net@freebsd.org
Subject:   Re: IP "routing" issue
Message-ID:  <2bba0bee-df34-f0d5-53d6-0190a58b21ec@grosbein.net>
In-Reply-To: <20200909164254.5e7e3891@debian>
References:  <20200909164254.5e7e3891@debian>

next in thread | previous in thread | raw e-mail | index | archive | help
09.09.2020 21:42, Abelenda Diego wrote:

> I've got a FreeBSD installation in a DataCenter that provided me with a single
> address IPv4 with an upstream gateway (cidr is fine the upstream gateway works
> everything is nice and running). I use this machine for Masquerading an private
> infrastructure.
> 
> Now I need other machines with public IPv4 and when I requested the additional
> IPv4 to the DataCenter, they gave me a bunch of /32 addresses saying that
> my previous IPv4 MUST be configured as next-hop on their side.
> From my understanding in FreeBSD the route command is unable to perform this
> kind of configuration where you tell that the IPv4 /32 is available without
> next-hop (no via) on a specific link. I know the linux "ip route add $IP dev
> $LINK" configures this, but I cannot seem to map this knowledge to FreeBSD.
> 
> Is it possible to perform this very special setup with any command on FreeBSD?
> If yes what is that command?

This setup is not special and FreeBSD can do it, of course.

route add 1.1.1.1/32 2.2.2.2
route add 1.1.2.1/32 -iface vtnet0

In this example 2.2.2.2 plays role of your old public IP and 1.1.X.X are for new addresses
routed via 2.2.2.2 or directly to interface vtnet0. And there is rc.conf settings "static_routes" to create such setup:

static_routes="host1 host2 host3"
route_host1="1.1.1.1/32 2.2.2.2"
route_host2="1.1.2.1/32 -iface vtnet0"

This is documented with route(8) and rc.conf(5) manual pages.

In case of P2P interface such variants have no real difference other than
used way to specify outgoing interface: by next-hop address or by interface name.
P2P interface may have no address assigned for remote side.

In case of Ethernet-link interface the difference is related to underlying ARP protocol cache,
will it be asked for MAC address of specified next-hop or directly for MAC address of target like 1.1.2.1.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2bba0bee-df34-f0d5-53d6-0190a58b21ec>