Score:3

netplan configuration - add static route

cn flag

I have a linux computer (Ubuntu 22.04) with 2 interfaces both on different VLAN's. One interface should be default gateway via ipv4 and the other interface should connect via ipv6.

This is my configuration

network:
   version: 2
   ethernets:
      wan:
         match:
            macaddress: fa:a1:d2:cd:8b:35
         set-name: wan
         addresses:
         - 2000:3000::d17/48
         dhcp4: false
         dhcp6: false
         accept-ra: false
      vpn:
         match:
            macaddress: fa:08:df:79:9b:b5
         set-name: vpn
         addresses:
         - 172.29.1.17/24
         dhcp4: false
         dhcp6: false
         routes:
         - to: 172.29.29.0/24
           via: 172.29.1.1
         nameservers:
            addresses:
            - 1.1.1.1



ip -6 route
2000:3000::/48 dev wan proto kernel metric 256 pref medium
fe80::/64 dev vpn proto kernel metric 256 pref medium
fe80::/64 dev wan proto kernel metric 256 pref medium


ip -6 neighbour
fe80::c6aa:bbcc:fe48:4681 dev wan lladdr aa:bb:cc:48:46:81 router STALE
2000:3000::1 dev wan lladdr aa:bb:cc:48:46:81 router STALE

The ipv6 gateway should be

ping -6 2000:3000::1
PING 2000:3000::1(2000:300::1) 56 data bytes
64 bytes from 2000:3000::1: icmp_seq=1 ttl=64 time=0.727 ms
64 bytes from 2000:3000::1: icmp_seq=2 ttl=64 time=0.278 ms

This works fine for the VPN interface but WAN ipv6 does not have a route, so I can't reach it from outside via ipv6. How can I add a route?

David avatar
cn flag
What version of Ubuntu are you using?
dummyuser avatar
uy flag
Hi Thomas, nice question, I do not really know the befit of this configuration, but I do not need to know all. IPv6 knows multiple ways of configuring routes. Most common for clients is receiving Route advertisements send by the router. You do not provide any info about you IP v6 router. Please add the following info: 1) Why did you configure the IPv6Adress `2000:3000::d17/48` on wan? 2) Output of `ip -6 route` ? 3) Output of `ip -6 neighbour` 4) What type of gateway is in front of the wan interface?
Score:3
uy flag

I extended your netplan file adding a static default ipv6 route

network:
   version: 2
   ethernets:
      wan:
         match:
            macaddress: fa:a1:d2:cd:8b:35
         set-name: wan
         addresses:
         - 2000:3000::d17/48
         dhcp4: false
         dhcp6: false
         accept-ra: false
         routes: 
         - to: ::/0
           via: "2000:3000::1"
           on-link: true

      vpn:
         match:
            macaddress: fa:08:df:79:9b:b5
         set-name: vpn
         addresses:
         - 172.29.1.17/24
         dhcp4: false
         dhcp6: false
         routes:
         - to: 172.29.29.0/24
           via: 172.29.1.1
         nameservers:
            addresses:
            - 1.1.1.1

This netplan file does not contain a default route for IPv4, guess that fitts your usecase. I'm not sure it the line on-link: true is needed, but it is in my config ...

Thomas Aichinger avatar
cn flag
You ar right. I changed the vpn routes from 172.29.29.0/24 to 0.0.0.0/0
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.