         config.append("# NAT Traversal configuration. \n")
         config.append("#   nat_traversal_support: check if the node is behind NAT\n\n")
         config.append("nat_traversal_support = \(natSwitch.isOn)\n\n\n")
-        config.append("# Encapsulated Map-Requests are sent to this map-resolver\n")
-        config.append("# You can define several map-resolvers. Encapsulated Map-Request messages will\n")
-        config.append("# be sent to only one.\n")
-        config.append("#   address: IPv4 or IPv6 address of the map resolver\n")
-        config.append("map-resolver        = {\n")
-        config.append("        \(defaults?.string(forKey: "mapResolver") ?? "")\n")
-        config.append("}\n\n\n")
+        if !natSwitch.isOn {
+            config.append("# Encapsulated Map-Requests are sent to this map-resolver\n")
+            config.append("# You can define several map-resolvers. Encapsulated Map-Request messages will\n")
+            config.append("# be sent to only one.\n")
+            config.append("#   address: IPv4 or IPv6 address of the map resolver\n")
+            config.append("map-resolver        = {\n")
+            config.append("        \(defaults?.string(forKey: "mapResolver") ?? "")\n")
+            config.append("}\n\n\n")
+        }
         config.append("# Map-Registers are sent to this map-server\n")
         config.append("# You can define several map-servers. Map-Register messages will be sent to all\n")
         config.append("# of them.\n")

    }
    
    @IBAction func saveButton(_ sender: Any) {
        if validateIpAddress(ip: eidTextField.text!) {
            saveConfig()
            saveLabel.text = "Configuration saved!"
        } else {
            let alert = UIAlertController(title: "Invalid EID", message: "Please enter a valid EID", preferredStyle: .alert)
            alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
            self.present(alert, animated: true)
        }
    }
    

        config.append("           weight        = 1\n")
        config.append("        }\n\n");
        config.append("}\n\n");
        if !natSwitch.isOn {
            config.append("proxy-etr-ipv4 {\n")
            config.append("        address     = \(petr)\n")
            config.append("        priority    = 1\n")
