diff --git a/src/device/mod.rs b/src/device/mod.rs
index 7b1f44d..e4a64c3 100644
--- a/src/device/mod.rs
+++ b/src/device/mod.rs
@@ -31,7 +31,9 @@ pub mod udp;
 use std::collections::HashMap;
 use std::convert::From;
 use std::io;
+use std::io::Write;
 use std::net::{IpAddr, SocketAddr};
+use std::os::unix::net::UnixStream;
 use std::os::unix::io::AsRawFd;
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::Arc;
@@ -132,6 +134,7 @@ pub struct DeviceConfig {
     pub n_threads: usize,
     pub use_connected_socket: bool,
     pub logger: Logger,
+    pub init_config: Option<String>,
     #[cfg(target_os = "linux")]
     pub use_multi_queue: bool,
 }
@@ -144,6 +147,7 @@ impl Default for DeviceConfig {
             logger: Logger::root(Discard, o!()),
             #[cfg(target_os = "linux")]
             use_multi_queue: true,
+            init_config: None,
         }
     }
 }
@@ -397,7 +401,6 @@ impl<T: Tun, S: Sock> Device<T, S> {
         device.register_iface_handler(Arc::clone(&device.iface))?;
         device.register_notifiers()?;
         device.register_timers()?;
-
         #[cfg(target_os = "macos")]
         {
             // Only for macOS write the actual socket name into WG_TUN_NAME_FILE
@@ -409,6 +412,18 @@ impl<T: Tun, S: Sock> Device<T, S> {
             }
         }
 
+        match device.config.init_config {
+            Some(ref c) => {
+                let namec = name.to_owned();
+                let cc = (*c).clone();
+                thread::spawn(move || {
+                    let path = format!("/var/run/wireguard/{}.sock", namec);
+                    let mut socket = UnixStream::connect(path).unwrap();
+                    write!(socket, "{}\n\n", cc).unwrap();
+                });
+            },
+            None => {},
+        }
         Ok(device)
     }
 
diff --git a/src/main.rs b/src/main.rs
index 5301372..9f5ff2a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -33,6 +33,14 @@ fn check_tun_name(_v: String) -> Result<(), String> {
     }
 }
 
+fn check_config_name(_v: String) -> Result<(), String> {
+    if _v.len() != 0 && !std::fs::metadata(_v).is_ok() {
+            Err("config file unable to be opened".to_owned())
+    } else {
+        Ok(())
+    }
+}
+
 fn main() {
     let matches = App::new("boringtun")
         .version(env!("CARGO_PKG_VERSION"))
@@ -76,6 +84,14 @@ fn main() {
             Arg::with_name("disable-connected-udp")
                 .long("disable-connected-udp")
                 .help("Disable connected UDP sockets to each peer"),
+            Arg::with_name("config")
+                .takes_value(true)
+                .long("config")
+                .short("-c")
+                .env("WG_CONFIG_FILE")
+                .validator(check_config_name)
+                .help("config file")
+                .default_value(""),
             #[cfg(target_os = "linux")]
             Arg::with_name("disable-multi-queue")
                 .long("disable-multi-queue")
@@ -88,7 +104,8 @@ fn main() {
     let n_threads = value_t!(matches.value_of("threads"), usize).unwrap_or_else(|e| e.exit());
     let log_level =
         value_t!(matches.value_of("verbosity"), slog::Level).unwrap_or_else(|e| e.exit());
-
+    let config_name = matches.value_of("config").unwrap();
+    let init_config = if config_name.len() > 0 { std::fs::read_to_string(config_name).expect("Unable to read file") } else { "".to_string() };
     // Create a socketpair to communicate between forked processes
     let (sock1, sock2) = UnixDatagram::pair().unwrap();
     let _ = sock1.set_nonblocking(true);
@@ -140,6 +157,7 @@ fn main() {
         n_threads,
         logger: logger.clone(),
         use_connected_socket: !matches.is_present("disable-connected-udp"),
+        init_config: if init_config.len() == 0 { None } else { Some(init_config) },
         #[cfg(target_os = "linux")]
         use_multi_queue: !matches.is_present("disable-multi-queue"),
     };

