How to make Linode prefer configured static IP for outgoing connections?
Hello, I have recently got a /64 block for my Linode on Ubuntu 18.04 LTS and wanted to setup a static ip from that range with reverse DNS for it.
I have set up a static IP using a Linode guide, turned off automatic network setup and here's my
network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no addresses: - 188.8.131.52/24 - "2a01:7e01:e001:154::69/64" gateway4: 184.108.40.206 gateway6: "fe80::1" nameservers: search: [members.linode.com] addresses: [220.127.116.11, "2a01:7e01::5"]
ip -6 addr shows
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 inet6 2a01:7e01::f03c:92ff:fee2:2cbc/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 2591976sec preferred_lft 604776sec inet6 2a01:7e01:e001:154::69/64 scope global valid_lft forever preferred_lft forever inet6 fe80::f03c:92ff:fee2:2cbc/64 scope link valid_lft forever preferred_lft forever
My (really maturely selected) IP address is there. But default IP
2a01:7e01::f03c:92ff:fee2:2cbc is still there too.
My DNS is managed my Mail-in-a-box, so I configured it to use
2a01:7e01:e001:154::69 as its public IP, and after running its setup again, I was able to set reverse DNS for that IP.
The only problem I still have, is that default IP is still there, and if I run
ip -6 route get 2001:4860:4860::8888 it shows
I would like for my Linode to prefer static IP for outgoing connections and not default one. If default IP must be there, it's ok
UPD: I tried using
accept-ra: no and while it disabled the default IP, my linode loses connectivity, so it doesn't seem to be a solution
Curiosly, while tinkering with netplan, I managed to get a config that worked correctly right before a reboot.
By replacing gateway6 with routes with link-local I got correct results, but after reboot I couln't even ping ipv6 sites, silence and 100% packet loss.
Hey @truechaotic, I have a similar setup, and I got it to work by setting
0 for the default IPv6 address:
ip addr change 2a01:7e01::f03c:92ff:fee2:2cbc dev eth0 preferred_lft 0
Unfortunately, netplan does not allow setting this option (see ), but you can search the web for work-arounds (e.g., ).
Thanks, @iliastsi. On my machine it worked, and request really went from IP I wanted. Strangely, after I ping6 Google, for example, default IP switches back.
I managed to make a netplan config that makes a persistent (between reboots) static IP and default route, in my case it looks like this
network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no addresses: - 18.104.22.168/24 - "2a01:7e01:e001:154::69/64" gateway4: 22.214.171.124 routes: - to: "::/0" via: "fe80::1" from: "2a01:7e01:e001:154::69" nameservers: search: [members.linode.com] addresses: [126.96.36.199, "2a01:7e01::5"]
The problem with my setup was that after I run MIAB setup script, system happily returns to using SLAAC address. I've posted a question to MIAB support forum. Maybe the setup script does something with system routing.
For now I wrote a shell script that changes a default route to one I need
ip route change "::/0" via "fe80::1" src "2a01:7e01:e001:154::69" dev eth0 curl -6 http://ip6only.me/api/