As said in this answer, radvd cannot overwrite the default gateway, but it can be modified without broadcasting with other programs. In a simple way, you can modify the advertisement with nftables, for example:
We can assume (data depends on the environment):
- LAN IPv6 address:
2001:db8::1111
- LAN interface name:
eth0
- Desired default gateway:
2001:db8::1
- Using the nftables
inet table.
$ sudo nft 'add table inet raw'
$ sudo nft 'add chain inet raw output { type filter hook output priority raw; policy accept; }'
$ sudo nft 'add rule inet raw output ip6 saddr 2001:db8::1111 oifname "eth0" ip6 daddr ff02::1 icmpv6 type nd-router-advert ip6 saddr set 2001:db8::1 notrack comment "RADVD"'
This produces:
table inet raw {
chain output {
type filter hook output priority raw; policy accept;
ip6 saddr 2001:db8::1111 oifname "eht0" ip6 daddr ff02::1 icmpv6 type nd-router-advert ip6 saddr set 2001:db8::1 notrack comment "RADVD"
}
}
I specified many parameters in the rule to match as much as possible the RA packets that radvd multicasts to ff02::1. But more parameters could be specified.
NOTE: This is not recommended for production, only for testing.