diff --git a/common/wireguard-types/src/config.rs b/common/wireguard-types/src/config.rs index 628702d731..16e7397c6f 100644 --- a/common/wireguard-types/src/config.rs +++ b/common/wireguard-types/src/config.rs @@ -9,9 +9,9 @@ pub struct Config { /// default: `0.0.0.0:51822` pub bind_address: SocketAddr, - /// Ip address of the private wireguard network. - /// default: `10.1.0.0` - pub private_network_ip: IpAddr, + /// Private IP address of the wireguard gateway. + /// default: `10.1.0.1` + pub private_ip: IpAddr, /// Port announced to external clients wishing to connect to the wireguard interface. /// Useful in the instances where the node is behind a proxy. diff --git a/common/wireguard/src/lib.rs b/common/wireguard/src/lib.rs index a71e579776..694446e147 100644 --- a/common/wireguard/src/lib.rs +++ b/common/wireguard/src/lib.rs @@ -24,14 +24,17 @@ pub async fn start_wireguard( let ifname = String::from("wg0"); let wgapi = WGApi::new(ifname.clone(), false)?; wgapi.create_interface()?; + log::info!("Created interface"); let interface_config = InterfaceConfiguration { name: ifname.clone(), prvkey: wireguard_data.keypair().private_key().to_string(), - address: wireguard_data.config().private_network_ip.to_string(), + address: wireguard_data.config().private_ip.to_string(), port: wireguard_data.config().announced_port as u32, peers, }; + log::info!("Configuring with {:?}", interface_config); wgapi.configure_interface(&interface_config)?; + log::info!("Configured interface"); // wgapi.configure_peer_routing(&peers)?; tokio::spawn(async move { task_client.recv().await }); diff --git a/documentation/operators/src/nodes/setup.md b/documentation/operators/src/nodes/setup.md index 969ccb0c90..3281bebe9c 100644 --- a/documentation/operators/src/nodes/setup.md +++ b/documentation/operators/src/nodes/setup.md @@ -148,8 +148,8 @@ Options: Specifies whether the wireguard service is enabled on this node [env: NYMNODE_WG_ENABLED=] [possible values: true, false] --wireguard-bind-address Socket address this node will use for binding its wireguard interface. default: `0.0.0.0:51822` [env: NYMNODE_WG_BIND_ADDRESS=] - --wireguard-private-network-ip - Ip address of the private wireguard network. default: `10.1.0.0` [env: NYMNODE_WG_IP_NETWORK=] + --wireguard-private-gw-ip + Private IP address of the wireguard gateway. default: `10.1.0.1` [env: NYMNODE_WG_IP=] --wireguard-announced-port Port announced to external clients wishing to connect to the wireguard interface. Useful in the instances where the node is behind a proxy [env: NYMNODE_WG_ANNOUNCED_PORT=] --wireguard-private-network-prefix diff --git a/nym-node/src/cli/helpers.rs b/nym-node/src/cli/helpers.rs index 1358b92072..02a2b9ce6c 100644 --- a/nym-node/src/cli/helpers.rs +++ b/nym-node/src/cli/helpers.rs @@ -253,13 +253,13 @@ pub(crate) struct WireguardArgs { )] pub(crate) wireguard_bind_address: Option, - /// Ip address of the private wireguard network. - /// default: `10.1.0.0` + /// Private IP address of the wireguard gateway. + /// default: `10.1.0.1` #[clap( long, - env = NYMNODE_WG_IP_NETWORK_ARG, + env = NYMNODE_WG_IP_ARG, )] - pub(crate) wireguard_private_network_ip: Option, + pub(crate) wireguard_private_ip: Option, /// Port announced to external clients wishing to connect to the wireguard interface. /// Useful in the instances where the node is behind a proxy. @@ -300,8 +300,8 @@ impl WireguardArgs { section.announced_port = announced_port } - if let Some(private_network_ip) = self.wireguard_private_network_ip { - section.private_network_ip = private_network_ip + if let Some(private_ip) = self.wireguard_private_ip { + section.private_ip = private_ip } if let Some(private_network_prefix) = self.wireguard_private_network_prefix { diff --git a/nym-node/src/config/exit_gateway.rs b/nym-node/src/config/exit_gateway.rs index 0c2502376b..972a0140ec 100644 --- a/nym-node/src/config/exit_gateway.rs +++ b/nym-node/src/config/exit_gateway.rs @@ -248,7 +248,7 @@ pub fn ephemeral_exit_gateway_config( config: super::Wireguard { enabled: config.wireguard.enabled, bind_address: config.wireguard.bind_address, - private_network_ip: config.wireguard.private_network_ip, + private_ip: config.wireguard.private_ip, announced_port: config.wireguard.announced_port, private_network_prefix: config.wireguard.private_network_prefix, storage_paths: config.wireguard.storage_paths.clone(), diff --git a/nym-node/src/config/mod.rs b/nym-node/src/config/mod.rs index 637ef0cb0d..d20a850647 100644 --- a/nym-node/src/config/mod.rs +++ b/nym-node/src/config/mod.rs @@ -40,7 +40,7 @@ pub use crate::config::mixnode::MixnodeConfig; const DEFAULT_NYMNODES_DIR: &str = "nym-nodes"; pub const DEFAULT_WIREGUARD_PORT: u16 = WG_PORT; -pub const DEFAULT_WIREGUARD_NETWORK_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(10, 1, 0, 0)); +pub const DEFAULT_WIREGUARD_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(10, 1, 0, 1)); pub const DEFAULT_WIREGUARD_PREFIX: u8 = 16; pub const DEFAULT_HTTP_PORT: u16 = DEFAULT_NYM_NODE_HTTP_PORT; pub const DEFAULT_MIXNET_PORT: u16 = DEFAULT_MIX_LISTENING_PORT; @@ -500,9 +500,9 @@ pub struct Wireguard { /// default: `0.0.0.0:51822` pub bind_address: SocketAddr, - /// Ip address of the private wireguard network. - /// default: `10.1.0.0` - pub private_network_ip: IpAddr, + /// Private IP address of the wireguard gateway. + /// default: `10.1.0.1` + pub private_ip: IpAddr, /// Port announced to external clients wishing to connect to the wireguard interface. /// Useful in the instances where the node is behind a proxy. @@ -524,7 +524,7 @@ impl Wireguard { IpAddr::V4(Ipv4Addr::UNSPECIFIED), DEFAULT_WIREGUARD_PORT, ), - private_network_ip: DEFAULT_WIREGUARD_NETWORK_IP, + private_ip: DEFAULT_WIREGUARD_IP, announced_port: DEFAULT_WIREGUARD_PORT, private_network_prefix: DEFAULT_WIREGUARD_PREFIX, storage_paths: persistence::WireguardPaths::new(data_dir), @@ -536,7 +536,7 @@ impl Into for Wireguard { fn into(self) -> nym_wireguard_types::Config { nym_wireguard_types::Config { bind_address: self.bind_address, - private_network_ip: self.private_network_ip, + private_ip: self.private_ip, announced_port: self.announced_port, private_network_prefix: self.private_network_prefix, } diff --git a/nym-node/src/config/template.rs b/nym-node/src/config/template.rs index 3881bf2bd0..ea6003d5e3 100644 --- a/nym-node/src/config/template.rs +++ b/nym-node/src/config/template.rs @@ -115,9 +115,9 @@ enabled = {{ wireguard.enabled }} # default: `0.0.0.0:51822` bind_address = '{{ wireguard.bind_address }}' -# Ip address of the private wireguard network. -# default: `10.1.0.0` -private_network_ip = '{{ wireguard.private_network_ip }}' +# Private IP address of the wireguard gateway. +# default: `10.1.0.1` +private_ip = '{{ wireguard.private_ip }}' # Port announced to external clients wishing to connect to the wireguard interface. # Useful in the instances where the node is behind a proxy. diff --git a/nym-node/src/env.rs b/nym-node/src/env.rs index 4ceeed736d..605c27f394 100644 --- a/nym-node/src/env.rs +++ b/nym-node/src/env.rs @@ -40,7 +40,7 @@ pub mod vars { // wireguard: pub const NYMNODE_WG_ENABLED_ARG: &str = "NYMNODE_WG_ENABLED"; pub const NYMNODE_WG_BIND_ADDRESS_ARG: &str = "NYMNODE_WG_BIND_ADDRESS"; - pub const NYMNODE_WG_IP_NETWORK_ARG: &str = "NYMNODE_WG_IP_NETWORK"; + pub const NYMNODE_WG_IP_ARG: &str = "NYMNODE_WG_IP"; pub const NYMNODE_WG_ANNOUNCED_PORT_ARG: &str = "NYMNODE_WG_ANNOUNCED_PORT"; pub const NYMNODE_WG_PRIVATE_NETWORK_PREFIX_ARG: &str = "NYMNODE_WG_PRIVATE_NETWORK_PREFIX"; diff --git a/nym-node/src/node/mod.rs b/nym-node/src/node/mod.rs index 86de589098..998d62a19e 100644 --- a/nym-node/src/node/mod.rs +++ b/nym-node/src/node/mod.rs @@ -576,7 +576,7 @@ impl NymNode { }; let wireguard_private_network = IpNetwork::new( - self.config.wireguard.private_network_ip, + self.config.wireguard.private_ip, self.config.wireguard.private_network_prefix, )?;