Score:0

ubuntu 22.04 routing using netplan

cn flag

Hi I have a new ubuntu server with 2 interfaces and i wrote a netpaln config for it like this:

network:
 version: 2
 renderer: networkd
 ethernets:
   ens160:
     dhcp4: no
     addresses:
       - 192.168.1.2/24
     routing-policy:
       - from: 192.168.1.0/24
         table: 160
     routes:
       - to:  0.0.0.0/0
         via: 192.168.1.1
       - to: 172.10.10.10
         via: 192.168.1.1
         on-link: true
         metric: 100
         table: 160
     nameservers:
       addresses:
         - 8.8.8.8
         - 4.2.2.4
     accept-ra: no
   ens192:
     dhcp4: no
     addresses:
       - 172.31.99.2/24
     routing-policy:
       - from: 172.31.99.0/24
         table: 192
     routes:
       # - to:  0.0.0.0/0
       #  via: 172.31.99.1
       - to:  172.22.22.22
         via: 172.31.99.1
         on-link: true
         metric: 100
         table: 192
     accept-ra: no 

I have 2 questions:

  1. If I uncomment the default gateway for ens192 I get this warnings :
** (generate:2260): WARNING **: 20:34:27.603: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160

** (process:2258): WARNING **: 20:34:28.411: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160

** (process:2258): WARNING **: 20:34:28.427: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160

** (process:2258): WARNING **: 20:34:28.970: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160

** (process:2258): WARNING **: 20:34:28.971: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens192 but also in ens160

why this happens? and second question: if I want to ping the destinations on routing table 160 or 192 no packet is transfered:

ping 172.20.20.20
4 packets transmitted, 0 received, 100% packet loss
ping 172.20.20.20 -I ens192
4 packets transmitted, 0 received, 100% packet loss

what is the solution? thanks for your attention.

Score:0
us flag

Your default routes on each interface also need to specify the table.

And in your example, you are pinging an IP that you don't currently have a route for on ens192.

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.