Default Gateway for a system v/s Default gateway per Interface

Patrick Williams patrick at stwcx.xyz
Thu May 7 01:24:10 AEST 2020


On Mon, May 04, 2020 at 09:14:05AM -0700, Johnathan Mantey wrote:
> Ratan,
> 
> We're not using Windows. What is the Linux kernel/systemd going to do
> for the Metric? So far the only value that has been applied to the
> Metric is "0" (assigned by ??). As the Microsoft article points out,
> using a low value Metric for "private" nets is to be avoided.
> Our DHCP servers are supplying a Metric value of 1024. I'm sure other
> network managers use different values.
> I don't know how to solve this issue. Especially for the IPMI use case
> of assigning a static address. IPMI doesn't have the ability to assign
> metric values. At least with Redfish we can have that feature added.

Lower metric values have priority (0 is most preferred).  By default
systemd-networkd sets DHCP routes to 1024 per [1].  You can set an 
alternative RouteMetric in a systemd-networkd network file to set up
a different preference.

I do this to automatically tether my phone to my computer when I
plug it in directly and prefer the network routes provided by the phone
by setting RouteMetric to 512:

```
$ cat /etc/systemd/network/30-iphone.network
[Match]
Name=iphone0

[Network]
DHCP=yes

[DHCPv4]
RouteMetric=512
```

[1]: https://www.freedesktop.org/software/systemd/man/systemd.network.html#UseRoutes=
[2]: https://www.freedesktop.org/software/systemd/man/systemd.network.html#RouteMetric=

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20200506/b56d726e/attachment.sig>


More information about the openbmc mailing list