Score:0

iproute2 and netplan configuration

so flag

I want to use 2 network interfaces, each one has its own default gateway, at the same time. I found on google that iproute2 program could solve my problem but I also have to config netplan in order to accomplish that. The only info I found is about /etc/network/interfaces

auto lo
iface lo inet loopback

allow-hotplug enp7s0
iface enp7s0 inet static
    address 192.168.0.101
    netmask 255.255.255.0
    gateway 192.168.0.1

allow-hotplug enp8s0
iface enp8s0 inet static
    address 192.168.1.16
    netmask 255.255.255.0

which is not on Ubuntu 22.04 anymore. How do I have this config applied to netplan?

Also, when I edited /etc/iproute2/rt_tables to add these lines

1 rt2

ip route add 192.168.0.0/24 dev enp7s0 src 192.168.0.101 table rt2
ip route add default via 192.168.0.1 dev enp7s0 table rt2
ip rule add from 192.168.0.101/32 table rt2
ip rule add to 192.168.0.101/32 table rt2

it came up with this error when I

ip rule show

Database /etc/iproute2/rt_tables is corrupted at ip route add 192.168.0.0/24 dev enp7s0 src 192.168.0.101 table rt2

0:  from all lookup local
32766:  from all lookup main
32767:  from all lookup default

Not sure where did it go wrong. Any help is appreciated

Score:0
so flag

solved using

sudo ip route add 192.168.0.0/24 dev enp7s0 src 192.168.0.101 table rt2
sudo ip route add default via 192.168.0.1 dev enp7s0 table rt2
sudo ip rule add from 192.168.0.101/32 table rt2
sudo ip rule add to 192.168.0.101/32 table rt2
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.