Last active
January 26, 2024 16:43
-
-
Save brianbianco/6319270d08a49576c78812f5c54ef80b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The old ifupdown config | |
# eth1_out was simply a routing table I added previously with the int value of 200 | |
cat << ENIINTERFACE >> /etc/network/interfaces.d/eth1.cfg | |
# The ENI interface | |
auto eth1 | |
iface eth1 inet static | |
address 172.16.19.254 | |
netmask 255.255.252.0 | |
up ip route add default via 172.16.16.1 dev eth1 table eth1_out | |
up ip rule add from 172.16.19.254/32 table eth1_out | |
up ip rule add to 172.16.19.254/32 table eth1_out | |
up ip route flush cache | |
ENIINTERFACE | |
# The netplan? | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
ens4: | |
addresses: | |
- 172.16.19.254/32 | |
routes: | |
- to: 0.0.0.0/0 | |
via: 172.16.16.1 | |
from: 172.16.19.254 | |
table: 200 | |
- to: 172.16.19.254 | |
via: 0.0.0.0 | |
scope: link | |
table: 200 | |
routing-policy: | |
- from: 172.16.19.254 | |
table: 200 | |
$ ip route show | |
default via 172.16.16.1 dev ens3 proto dhcp src 172.16.17.46 metric 100 | |
172.16.16.0/22 dev ens3 proto kernel scope link src 172.16.17.46 | |
172.16.16.1 dev ens3 proto dhcp scope link src 172.16.17.46 metric 100 | |
192.168.200.0/24 dev docker0 proto kernel scope link src 192.168.200.1 linkdown |
Your ifupdown file would look something like this in netplan
network:
version: 2
renderer: networkd
ethernets:
eth1:
addresses:
- 172.16.19.254/22
routes:
- to: default
via: 172.16.16.1
table: 200
routing-policy:
- from: 172.16.19.254
table: 200
- to: 172.16.19.254
table: 200
This works! I simply had to change the interface name to match mine!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
info from old working ifupdown setup