diff --git a/ic-os/guestos/docs/ConfigStore.adoc b/ic-os/guestos/docs/ConfigStore.adoc index b0195992f29..62d6470843e 100644 --- a/ic-os/guestos/docs/ConfigStore.adoc +++ b/ic-os/guestos/docs/ConfigStore.adoc @@ -63,8 +63,6 @@ Must be a file of key/value pairs separated by "=" (one per line) with the follo - *name_servers*: The ipv6 name servers to be used. If multiple servers are needed, separate them with spaces. This key is only meaningful if DHCP or SLAAC is not used. -- *ipv4_name_servers*: The ipv4 name servers to be used. If multiple servers are needed, separate them with spaces. This key is only meaningful if DHCP or SLAAC is not used. - - *hostname*: The hostname, which can be any text in principle but is generally derived from the ID of the physical host (e.g., MAC address). Note: if this file is not given, the system will fall back to network auto configuration. diff --git a/ic-os/guestos/rootfs/opt/ic/bin/generate-replica-config.sh b/ic-os/guestos/rootfs/opt/ic/bin/generate-replica-config.sh index b17133e7564..7bf5b26cb79 100755 --- a/ic-os/guestos/rootfs/opt/ic/bin/generate-replica-config.sh +++ b/ic-os/guestos/rootfs/opt/ic/bin/generate-replica-config.sh @@ -75,7 +75,6 @@ function read_network_variables() { "ipv6_address") ipv6_address="${value}" ;; "ipv6_gateway") ipv6_gateway="${value}" ;; "name_servers") name_servers="${value}" ;; - "ipv4_name_servers") ipv4_name_servers="${value}" ;; "ipv4_address") ipv4_address="${value}" ;; "ipv4_gateway") ipv4_gateway="${value}" ;; "domain") domain="${value}" ;; diff --git a/ic-os/hostos/rootfs/opt/ic/bin/generate-guestos-config.sh b/ic-os/hostos/rootfs/opt/ic/bin/generate-guestos-config.sh index c792affa673..519c52088fd 100755 --- a/ic-os/hostos/rootfs/opt/ic/bin/generate-guestos-config.sh +++ b/ic-os/hostos/rootfs/opt/ic/bin/generate-guestos-config.sh @@ -110,7 +110,6 @@ function assemble_config_media() { cmd+=(--ipv4_gateway "${ipv4_gateway}") cmd+=(--domain "${domain}") fi - cmd+=(--ipv4_name_servers "$(/opt/ic/bin/fetch-property.sh --key=.dns.ipv4_name_servers --metric=hostos_ipv4_dns_name_servers --config=${DEPLOYMENT})") cmd+=(--hostname "guest-$(/opt/ic/bin/fetch-mgmt-mac.sh | sed 's/://g')") cmd+=(--nns_url "$(/opt/ic/bin/fetch-property.sh --key=.nns.url --metric=hostos_nns_url --config=${DEPLOYMENT})") if [ -f "/boot/config/node_operator_private_key.pem" ]; then diff --git a/ic-os/scripts/build-bootstrap-config-image.sh b/ic-os/scripts/build-bootstrap-config-image.sh index a139cea3f28..d2f65042582 100755 --- a/ic-os/scripts/build-bootstrap-config-image.sh +++ b/ic-os/scripts/build-bootstrap-config-image.sh @@ -33,11 +33,6 @@ options may be specified: script, e.g. --ipv6_name_servers "2606:4700:4700::1111 2606:4700:4700::1001"). - --ipv4_name_servers servers - ipv4 DNS servers to use. Can be multiple servers separated by space (make - sure to quote the argument string so it appears as a single argument to the - script, e.g. --ipv4_name_servers "1.1.1.1 1.0.0.1"). - --ipv4_address a.b.c.d/n (optional) The IPv4 address to assign. Must include prefix length (e.g. 18.208.190.35/28). @@ -131,7 +126,7 @@ function build_ic_bootstrap_tar() { local OUT_FILE="$1" shift - local IPV6_ADDRESS IPV6_GATEWAY IPV6_NAME_SERVERS IPV4_NAME_SERVERS DOMAIN HOSTNAME + local IPV6_ADDRESS IPV6_GATEWAY IPV6_NAME_SERVERS DOMAIN HOSTNAME local IC_CRYPTO IC_REGISTRY_LOCAL_STORE local NNS_URL NNS_PUBLIC_KEY NODE_OPERATOR_PRIVATE_KEY local BACKUP_RETENTION_TIME_SECS BACKUP_PURGING_INTERVAL_SECS @@ -156,9 +151,6 @@ function build_ic_bootstrap_tar() { --ipv6_name_servers) IPV6_NAME_SERVERS="$2" ;; - --ipv4_name_servers) - IPV4_NAME_SERVERS="$2" - ;; --ipv4_address) IPV4_ADDRESS="$2" ;; @@ -234,7 +226,6 @@ function build_ic_bootstrap_tar() { ${IPV6_ADDRESS:+ipv6_address=$IPV6_ADDRESS} ${IPV6_GATEWAY:+ipv6_gateway=$IPV6_GATEWAY} name_servers=$IPV6_NAME_SERVERS -ipv4_name_servers=$IPV4_NAME_SERVERS hostname=$HOSTNAME ${IPV4_ADDRESS:+ipv4_address=$IPV4_ADDRESS} ${IPV4_GATEWAY:+ipv4_gateway=$IPV4_GATEWAY} diff --git a/ic-os/setupos/data/deployment.json.template b/ic-os/setupos/data/deployment.json.template index 5420e7d2a8d..22583cf8860 100644 --- a/ic-os/setupos/data/deployment.json.template +++ b/ic-os/setupos/data/deployment.json.template @@ -9,8 +9,7 @@ "url": "NNS_URL" }, "dns": { - "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844", - "ipv4_name_servers": "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4" + "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844" }, "resources": { "memory": "490" diff --git a/rs/ic_os/guestos_tool/src/generate_network_config.rs b/rs/ic_os/guestos_tool/src/generate_network_config.rs index 38743d8b903..e056f1b20a9 100644 --- a/rs/ic_os/guestos_tool/src/generate_network_config.rs +++ b/rs/ic_os/guestos_tool/src/generate_network_config.rs @@ -8,17 +8,19 @@ use anyhow::{bail, Context, Result}; use config::config_map_from_path; use network::interfaces::{get_interface_name as get_valid_interface_name, get_interface_paths}; -use network::systemd::{generate_ipv4_nameserver_list, generate_ipv6_nameserver_list}; +use network::systemd::generate_ipv6_nameserver_list; use utils::get_command_stdout; pub static DEFAULT_GUESTOS_NETWORK_CONFIG_PATH: &str = "/boot/config/network.conf"; +const IPV4_NAME_SERVER_NETWORKD_CONTENTS: &str = + "DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n"; + #[derive(Debug)] struct NetworkInfo { ipv6_info: Option, ipv6_name_servers: Option, ipv4_info: Option, - ipv4_name_servers: Option, } #[derive(Debug)] @@ -169,17 +171,10 @@ fn create_network_info( .map(generate_ipv6_nameserver_list) .transpose()?; - let ipv4_name_servers = network_config_variables - .get("ipv4_name_servers") - .map(|ipv4_name_servers| ipv4_name_servers.split_whitespace()) - .map(generate_ipv4_nameserver_list) - .transpose()?; - Ok(NetworkInfo { ipv6_info, ipv6_name_servers, ipv4_info, - ipv4_name_servers, }) } @@ -206,10 +201,7 @@ fn generate_networkd_config_contents( let match_contents = generate_network_config_match_contents(interface_name); let ipv6_contents = generate_network_config_ipv6_contents(network_info.ipv6_info, disable_dad); let ipv6_name_servers = generate_network_config_dns_contents(network_info.ipv6_name_servers); - let ipv4_contents = generate_network_config_ipv4_contents( - network_info.ipv4_info, - network_info.ipv4_name_servers, - ); + let ipv4_contents = generate_network_config_ipv4_contents(network_info.ipv4_info); format!( "{}{}{}\n{}", @@ -260,10 +252,7 @@ fn generate_network_config_dns_contents(name_servers: Option) -> String name_servers.unwrap_or_default() } -fn generate_network_config_ipv4_contents( - ipv4_info: Option, - ipv4_name_servers: Option, -) -> String { +fn generate_network_config_ipv4_contents(ipv4_info: Option) -> String { ipv4_info .map(|ipv4_info| { indoc::formatdoc!( @@ -274,7 +263,7 @@ fn generate_network_config_ipv4_contents( "#, ipv4_info.address_with_prefix, ipv4_info.gateway, - ipv4_name_servers.unwrap_or_default() + IPV4_NAME_SERVER_NETWORKD_CONTENTS ) }) .unwrap_or_default() @@ -335,10 +324,6 @@ mod tests { "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844" .to_string(), ); - network_config_variables.insert( - "ipv4_name_servers".to_string(), - "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4".to_string(), - ); eprintln!("network_config_variables: {:?}", network_config_variables); @@ -359,13 +344,6 @@ mod tests { assert!(result.ipv6_name_servers.is_some()); let ipv6_name_servers = result.ipv6_name_servers.unwrap(); assert_eq!(ipv6_name_servers, "DNS=2606:4700:4700::1111\nDNS=2606:4700:4700::1001\nDNS=2001:4860:4860::8888\nDNS=2001:4860:4860::8844\n"); - - assert!(result.ipv4_name_servers.is_some()); - let ipv4_name_servers = result.ipv4_name_servers.unwrap(); - assert_eq!( - ipv4_name_servers, - "DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n" - ); } #[test] @@ -378,10 +356,6 @@ mod tests { "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844" .to_string(), ); - network_config_variables.insert( - "ipv4_name_servers".to_string(), - "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4".to_string(), - ); eprintln!("network_config_variables: {:?}", network_config_variables); @@ -397,13 +371,6 @@ mod tests { assert!(result.ipv6_name_servers.is_some()); let ipv6_name_servers = result.ipv6_name_servers.unwrap(); assert_eq!(ipv6_name_servers, "DNS=2606:4700:4700::1111\nDNS=2606:4700:4700::1001\nDNS=2001:4860:4860::8888\nDNS=2001:4860:4860::8844\n"); - - assert!(result.ipv4_name_servers.is_some()); - let ipv4_name_servers = result.ipv4_name_servers.unwrap(); - assert_eq!( - ipv4_name_servers, - "DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n" - ); } #[test] @@ -517,7 +484,6 @@ mod tests { ipv6_info: Some(IpAddressInfo::new_ipv6_address("2001:db8::1/64", "2001:db8::1").unwrap()), ipv6_name_servers: Some("DNS=2606:4700:4700::1111\nDNS=2606:4700:4700::1001\nDNS=2001:4860:4860::8888\nDNS=2001:4860:4860::8844\n".to_string()), ipv4_info: Some(IpAddressInfo::new_ipv4_address("192.168.1.100", "30", "192.168.1.1").unwrap()), - ipv4_name_servers: Some("DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n".to_string()), }; let interface_name = "enp65s0f1"; @@ -533,7 +499,6 @@ mod tests { ipv6_info: Some(IpAddressInfo::new_ipv6_address("2001:db8::1/64", "2001:db8::1").unwrap()), ipv6_name_servers: Some("DNS=2606:4700:4700::1111\nDNS=2606:4700:4700::1001\nDNS=2001:4860:4860::8888\nDNS=2001:4860:4860::8844\n".to_string()), ipv4_info: None, - ipv4_name_servers: Some("DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n".to_string()), }; let interface_name = "enp65s0f1"; @@ -549,7 +514,6 @@ mod tests { ipv6_info: Some(IpAddressInfo::new_ipv6_address("2001:db8::1/64", "2001:db8::1").unwrap()), ipv6_name_servers: Some("DNS=2606:4700:4700::1111\nDNS=2606:4700:4700::1001\nDNS=2001:4860:4860::8888\nDNS=2001:4860:4860::8844\n".to_string()), ipv4_info: Some(IpAddressInfo::new_ipv4_address("192.168.1.100", "30", "192.168.1.1").unwrap()), - ipv4_name_servers: Some("DNS=1.1.1.1\nDNS=1.0.0.1\nDNS=8.8.8.8\nDNS=8.8.4.4\n".to_string()), }; let interface_name = "enp65s0f1"; @@ -565,7 +529,6 @@ mod tests { ipv6_info: None, ipv6_name_servers: None, ipv4_info: None, - ipv4_name_servers: None, }; let interface_name = "enp65s0f1"; diff --git a/rs/ic_os/network/src/systemd.rs b/rs/ic_os/network/src/systemd.rs index 7e5c0f87d29..e85a2decfa7 100644 --- a/rs/ic_os/network/src/systemd.rs +++ b/rs/ic_os/network/src/systemd.rs @@ -1,5 +1,5 @@ use std::fs::{create_dir_all, write}; -use std::net::{Ipv4Addr, Ipv6Addr}; +use std::net::Ipv6Addr; use std::path::Path; use std::process::Command; @@ -28,23 +28,6 @@ where Ok(result) } -pub fn generate_ipv4_nameserver_list<'a, I>(nameservers: I) -> Result -where - I: IntoIterator, -{ - let mut result = String::new(); - for nameserver in nameservers { - if nameserver.parse::().is_err() { - bail!( - "Invalid nameserver found in deployment config: {}", - nameserver - ); - } - result.push_str(&format!("DNS={nameserver}\n")); - } - Ok(result) -} - fn generate_network_interface_content(interface_name: &str) -> String { format!( " diff --git a/rs/ic_os/utils/src/deployment.rs b/rs/ic_os/utils/src/deployment.rs index 928b8c6db72..eb9cae018d0 100644 --- a/rs/ic_os/utils/src/deployment.rs +++ b/rs/ic_os/utils/src/deployment.rs @@ -33,7 +33,6 @@ pub struct Nns { #[derive(Serialize, Deserialize, PartialEq, Debug)] pub struct Dns { pub name_servers: String, - pub ipv4_name_servers: String, } #[serde_as] @@ -66,8 +65,7 @@ mod test { "url": "https://dfinity.org/" }, "dns": { - "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844", - "ipv4_name_servers": "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4" + "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844" }, "resources": { "memory": "490" @@ -79,7 +77,7 @@ mod test { deployment: Deployment { name: "mainnet".to_string() }, logging: Logging { hosts: "elasticsearch-node-0.mercury.dfinity.systems:443 elasticsearch-node-1.mercury.dfinity.systems:443 elasticsearch-node-2.mercury.dfinity.systems:443 elasticsearch-node-3.mercury.dfinity.systems:443".to_string() }, nns: Nns { url: Url::parse("https://dfinity.org").unwrap() }, - dns: Dns { name_servers: "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844".to_string(), ipv4_name_servers: "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4".to_string()}, + dns: Dns { name_servers: "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844".to_string()}, resources: Resources { memory: 490, cpu: None }, } }); @@ -95,8 +93,7 @@ mod test { "url": "https://dfinity.org/" }, "dns": { - "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844", - "ipv4_name_servers": "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4" + "name_servers": "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844" }, "resources": { "memory": "490", @@ -109,7 +106,7 @@ mod test { deployment: Deployment { name: "mainnet".to_string() }, logging: Logging { hosts: "elasticsearch-node-0.mercury.dfinity.systems:443 elasticsearch-node-1.mercury.dfinity.systems:443 elasticsearch-node-2.mercury.dfinity.systems:443 elasticsearch-node-3.mercury.dfinity.systems:443".to_string() }, nns: Nns { url: Url::parse("https://dfinity.org").unwrap() }, - dns: Dns { name_servers: "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844".to_string(), ipv4_name_servers: "1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4".to_string() }, + dns: Dns { name_servers: "2606:4700:4700::1111 2606:4700:4700::1001 2001:4860:4860::8888 2001:4860:4860::8844".to_string()}, resources: Resources { memory: 490, cpu: Some("qemu".to_string()) }, } }); diff --git a/testnet/tools/build-guestos-configs.sh b/testnet/tools/build-guestos-configs.sh index fed1bf5332b..55f74956251 100755 --- a/testnet/tools/build-guestos-configs.sh +++ b/testnet/tools/build-guestos-configs.sh @@ -132,11 +132,10 @@ CONFIG="$(cat ${INPUT})" VALUES=$(echo ${CONFIG} | jq -r -c '[ .deployment, (.name_servers | join(" ")), - (.ipv4_name_servers | join(" ")), (.elasticsearch_hosts | join(" ")), (.elasticsearch_tags | join(" ")) ] | join("\u0001")') -IFS=$'\1' read -r DEPLOYMENT NAME_SERVERS IPV4_NAME_SERVERS ELASTICSEARCH_HOSTS ELASTICSEARCH_TAGS < <(echo $VALUES) +IFS=$'\1' read -r DEPLOYMENT NAME_SERVERS ELASTICSEARCH_HOSTS ELASTICSEARCH_TAGS < <(echo $VALUES) # Read all the node info out in one swoop NODES=0 @@ -325,7 +324,6 @@ function build_bootstrap_images() { "--nns_url" "${NNS_URL}" \ "--nns_public_key" "${IC_PREP_DIR}/nns_public_key.pem" \ "--ipv6_name_servers" "${NAME_SERVERS}" \ - "--ipv4_name_servers" "${IPV4_NAME_SERVERS}" \ "--hostname" "${hostname}" \ "--accounts_ssh_authorized_keys" "${SSH}" \ ${ELASTICSEARCH_HOSTS:+"--elasticsearch_hosts"} ${ELASTICSEARCH_HOSTS:+"${ELASTICSEARCH_HOSTS}"} \