I'm trying to add a static route on my Ubuntu Desktop 16.04 machine with the cli, but with no success. I'm using the classic ip route command:
ip route add x.x.x.0/24 via y.y.y.y dev eno1 (hid the actual addresses here), and I receive the following error:
RTNETLINK answers: Network is unreachable. My machine will access y.y.y.y through its default gateway. The actual routing from the default gateway to y.y.y.y which will route to x.x.x.x is already set and working.
The error received is fine by me, as it is actually reachable (tested myself), as must be a false error caused by network components (such as FW).
My question is: is there a way to ignore that error? This error is causing the static routing not to be saved, and I want it to be saved even though the command thinks it is unreachable.
route command shows only my
link-local acquired by the dhcp and also shows my
Why am I using the cli?
I know Ubuntu 16.04 should use
/etc/network/interfaces, and Ubuntu 18.04 and above versions use
/etc/netplan, but my
/etc/network/interfaces file is absolutely empty (probably because of the dhcp method).
Edit: contents of
auto lo iface lo inet loopback
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default z.z.z.254 0.0.0.0 UG 100 0 0 eno1 z.z.z.0 * 255.255.255.0 U 100 0 0 eno1 link-local * 255.255.255.0 U 1000 0 0 eno1 g.g.g.0 * 255.255.255.0 U 0 0 0 vmnet1
ip route list command:
default via z.z.z.254 dev eno1 proto static metric 100 z.z.z.0/24 dev eno1 proto kernel scope link src z.z.z.101 metric 100 169.254.0.0/16 dev eno1 scope link metric 1000 g.g.g.0/24 dev vmnet1 proto kernel scope link src z.z.z.1
Overall, I'm looking for a way to sometimes force a path for a machine without having to create a virtual interface and configure my network components for that interface.
route print? From my unprofessional opinion it's stating that the router/gateway you've defined isn't reachable in your layer-2 broadcast domain, hence it cannot be your next hop; you need to point to your L2 broadcast, and add the route on the router.
/24route - meaning, if you have
192.168.0.1-255and you want to route to
10.1.0.1, your next hope needs to be in the logical
192.168.0range, and the static route needs to be added to
10.1.0.1- is this what you're doing?