# nmcli fails to update DNS servers

**URL:** <https://forum.ansible.com/t/nmcli-fails-to-update-dns-servers/36390>\
**Category:** Ansible Project\
**Created:** [March 2, 2022, 10:53am UTC](https://forum.ansible.com/t/nmcli-fails-to-update-dns-servers/36390 "2022-03-02T10:53:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev1](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Anand\_Buddhdev1](https://forum.ansible.com/u/Anand_Buddhdev1)\
**Post date:** [March 2, 2022, 10:53am UTC](https://forum.ansible.com/t/nmcli-fails-to-update-dns-servers/36390/1 "2022-03-02T10:53:16Z")

</div>

I’m running ansible-core 2.12.3, on python 3.10, with 2 collections installed:

Collection Version

* * *

ansible.posix 1.3.0  
community.general 4.5.0

I’m trying to use the nmcli module to set the DNS servers for a connection, and it’s failing thus:

ansible HOST -m nmcli -a “conn\_name=em1 type=ethernet state=present dns6=‘::1 2620:fe::fe’”  
HOST | FAILED! =\> {  
“ansible\_facts”: {  
“discovered\_interpreter\_python”: “/usr/bin/python”  
},  
“changed”: false,  
“msg”: “Error: Failed to modify connection ‘em1’: ipv4.gateway: gateway cannot be set if there are no addresses configured\n”,  
“name”: “em1”,  
“rc”: 1  
}

I don’t want/need to change the IP address settings, just the DNS. Any idea why nmcli is failing?

Regards,  
Anand
