I'm trying to set up a server with 192.... addresses that is able to access the outside world using the gateway provided by my colo. I'm looking at the "Directly connected gateway" example at https://netplan.io/examples#directly-connected-gateway
I also have looked at and tried:
Routes in Netplan... using routes: from the example says unknown key
(but the second one is so obfuscated that I can't figure it out...)
My colo provided gateway is 207.178.166.185. I want anything on the outside world to go through it. I guess I probably don't want things on local networks like 192..., 10..., etc to go through the gateway.
But if what I'm doing is possible I'll just set up another gateway.
Here's what I have so far that doesn't work, where I try to get the eno2 interface to go through the gateway:
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: [192.168.1.10/24]
gateway4: 192.168.1.20
dhcp4: no
nameservers:
addresses: [207.178.128.20, 207.178.128.21]
eno2:
addresses: [192.168.1.11/24]
#gateway4: 192.168.1.20
dhcp4: no
nameservers:
addresses: [207.178.128.20, 207.178.128.21]
routes:
- to: 0.0.0.0/0
via: 207.178.166.185
on-link: true
then I test it with a ping on that eno2 interface:
decker@dbu2:~$ ping -I eno2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.11 eno2: 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2043ms
The reason I'm doing this is because my gateway at 192.168.1.20 went down, and rather than set up another gateway I'd like it if this server could just connect to the outside world on its own.