23 lines
550 B
Nix
23 lines
550 B
Nix
|
{ ... }:
|
||
|
|
||
|
rec {
|
||
|
llIPv6 = localIP: peerIP: interface: {
|
||
|
ips = [
|
||
|
"${localIP}/128"
|
||
|
];
|
||
|
postSetup = ''
|
||
|
ip -6 route flush dev ${interface}
|
||
|
ip addr del dev ${interface} ${localIP}/128 && ip addr add dev ${interface} ${localIP}/128 peer ${peerIP}/128
|
||
|
'';
|
||
|
};
|
||
|
llIPv4 = localIP: peerIP: interface: {
|
||
|
ips = [
|
||
|
"${localIP}/32"
|
||
|
];
|
||
|
postSetup = ''
|
||
|
ip -4 route flush dev ${interface}
|
||
|
ip addr del dev ${interface} ${localIP}/32 && ip addr add dev ${interface} ${localIP}/32 peer ${peerIP}/32
|
||
|
'';
|
||
|
};
|
||
|
}
|