Home/Support/Support Forum/How can I change the DNS server addresses?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How can I change the DNS server addresses?

0 votes
I would like to be able to change the DNS addresses by console. Is there a definite function or any concrete example that demonstrates how to do it?
asked Jul 10, 2018 in Rabbit Software by d.Mate New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
From your code, you can call ifconfig() with the parameters IFS_NAMESERVER_SET (to clear all name servers and set the first one) and IFS_NAMESERVER_ADD (to add additional name servers).

If you're using the zconsole library, look at Samples/zconsole/userblock_tcpipconsole.c, it includes commands to change the DNS addresses:
{ "SET NAMESERVER", con_set_nameserver, help_set_txt }, { "ADD NAMESERVER", con_add_nameserver, help_add_nameserver_txt },
answered Jul 10, 2018 by TomCollins Veteran of the Digi Community (2,222 points)
Oh, wow. It's easier than I thought, it worked perfectly for me. Thank you very much for the reply.