diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install
index 895c0397ab..310996be95 100644
--- a/core/modules/comment/comment.install
+++ b/core/modules/comment/comment.install
@@ -208,3 +208,23 @@ function comment_update_8301() {
 /**
  * @} End of "addtogroup updates-8.3.x".
  */
+
+/**
+ * @addtogroup updates-8.4.x
+ * @{
+ */
+
+/**
+ * Add new comment settings.
+ */
+function comment_update_8401() {
+  $config_factory = \Drupal::configFactory();
+  $rest_settings = $config_factory->getEditable('comment.settings');
+  $rest_settings->set('log_ip_addresses', TRUE)
+                ->save(TRUE);
+}
+
+/**
+ * @} End of "addtogroup updates-8.4.x".
+ */
+
diff --git a/core/modules/comment/config/install/comment.settings.yml b/core/modules/comment/config/install/comment.settings.yml
new file mode 100644
index 0000000000..b4824a8c7b
--- /dev/null
+++ b/core/modules/comment/config/install/comment.settings.yml
@@ -0,0 +1 @@
+log_ip_addresses: false
diff --git a/core/modules/comment/config/schema/comment.schema.yml b/core/modules/comment/config/schema/comment.schema.yml
index a55488a222..d6dfa90150 100644
--- a/core/modules/comment/config/schema/comment.schema.yml
+++ b/core/modules/comment/config/schema/comment.schema.yml
@@ -1,4 +1,11 @@
 # Schema for the configuration files of the Comment module.
+comment.settings:
+  type: config_object
+  label: 'Comment settings'
+  mapping:
+    log_ip_addresses:
+      type: boolean
+      label: 'Whether to log IP addresses with comments or not.'
 
 field.formatter.settings.comment_default:
   type: mapping
