Convert from cloud-init networking to static networking
This is honestly pretty ugly. The issue is that I want two different IPv6 addresses on this server. I get one address for free as part of my hosting agreement. The other I have to pay $0.01 per month for. The address is routable, but it's not provided via cloud-init like the initial address. I therefore took the data from /var/lib/cloud/instance/network-config.json and translated it into this configuration manually. It's dangerous - I don't know when any of this information may change. However, it works, and both addresses are now bound to eth0. Notice that I set the network configuration name to "09-wan". This is because the previous configuration using cloud-init created a network configuration at /etc/systemd/network/10-cloud-init that has to be manually removed or superseded.
This commit is contained in:
parent
99f0311a38
commit
3993b526a5
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
services.cloud-init = {
|
services.cloud-init = {
|
||||||
enable = true;
|
enable = true;
|
||||||
network.enable = true;
|
network.enable = false;
|
||||||
};
|
};
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -77,7 +77,29 @@
|
||||||
sessionSecret = "secret";
|
sessionSecret = "secret";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.enable = true;
|
systemd.network = {
|
||||||
|
enable = true;
|
||||||
|
networks."09-wan" = {
|
||||||
|
address = [
|
||||||
|
"194.135.104.85/24"
|
||||||
|
"2605:e440::2:1d5/64"
|
||||||
|
"2605:e440::2:3e/64"
|
||||||
|
];
|
||||||
|
dns = [
|
||||||
|
"8.8.8.8"
|
||||||
|
"8.8.4.4"
|
||||||
|
"2001:4860:4860::8888"
|
||||||
|
"2001:4860::8844"
|
||||||
|
];
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
|
matchConfig.Name = "eth0";
|
||||||
|
routes = [
|
||||||
|
{ Gateway = "194.135.104.1"; }
|
||||||
|
{ Gateway = "2605:e440::1"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "America/Phoenix";
|
time.timeZone = "America/Phoenix";
|
||||||
|
|
Loading…
Reference in New Issue