Interface as a default gateway
Dan Purgert
dan at djph.net
Mon Mar 16 16:33:21 UTC 2015
On Sun, 15 Mar 2015 13:05:24 +1100, Karl Auer wrote:
> On Sat, 2015-03-14 at 21:41 -0400, Tom H wrote:
>> On Sat, Mar 14, 2015 at 6:41 PM, Karl Auer <kauer at biplane.com.au>
>> wrote:
>> >> 1) It would have to be "ip r add 0.0.0.0/0 via ip_add_of_eth0 dev
>> >> eth0".
>> > The address may not be needed. That is "ip r add 0.0.0.0/0 dev eth0"
>> > may also work. I'm not sure with a virtual network.
>> I meant to "ip r add 0.0.0.0/0 via ip_add_of_gateway dev eth0"
>
> Even so - the "via" address may not be needed. Specifying just the
> interface means that packets for the target network will be shipped out
> the interface, regardless of addressing. It's typically seen on
> point-to-point links, where there is only one place for an outbound
> packet to go. On ethernet I'm not sure - there may need to be a
> destination address for ARP (IPv4) or ND (IP6) to work with.
Not that you /can't/ do it the way you've suggested, but if you're going
to be sending to multiple hosts beyond that interface, doing the routing
entry as "destination_net via some_IP" as Tom wrote is the preferred
method for scalability / resource use considerations (IIRC).
With a small enough netblock (e.g. /26), it's probably a wash in terms of
system resources used; though since we're discussing a default route, you
might run into trouble after a while, as the router is spending too many
resources (including time) trying to keep up with everything. Granted
since we're talking about a virtual network running on a PC, your
physical resource constraints (CPU / RAM / etc) are going to be less of
an issue as compared to an appliance.
More information about the ubuntu-users
mailing list