Score:0

Translating ip route add into netplan

ru flag

Would you please help me with one simple question. I would like to have persistent route in my network settings.

How can I reproduce this command in netplan (Ubuntu 22.10):

sudo ip route add 10.0.10.0/24 via 10.0.0.1 dev enp3s0

I just get messed with all these YAML markup. Sorry for this.

Score:1
sk flag

Use routes to and from, see below,

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: false
      addresses: [<your IP>/24]
      routes:
        - to: 10.0.10.0/24
          via: 10.0.0.1
          metric: 100

I would also advise using netplan try when making routing edits as if your remoted and muck up something you can get locked out.

dyedfox avatar
ru flag
Thank you very much. My pc obtains ip address from dhcp. Will this work? dhcp4: true adresses:[10.0.0.0/24]
user2076574 avatar
sk flag
It should, I've only ever used it with static networks though.
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.