Getting default gateway address after DHCP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Getting default gateway address after DHCP

跳至解决方案
1,368 次查看
oscargarciaabad
Contributor III

Hello all,

I'm running MQX 4.1 on a custom board based on TWR-K60F120M.

I want to get the default gateway IP of my system after setting up the network using DHCP. I will use this address

as the DNS server.

is that ok or is it a better way to do so?

Best regards,

Óscar.

0 项奖励
回复
1 解答
1,126 次查看
matthewkendall
Contributor V

Generally the DHCP server will give you a DNS server address (in addition to your own address, the netmask and the default gateway address), so you don't have to do anything.

The list of things that the DCHP server gives you is flexible and is generally configurable on the server, but DNS server address is almost always included in the list.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,126 次查看
oscargarciaabad
Contributor III

Hi,

Garabo, many thanks for this link is really interesting.

Matthew, you are right I tried and DNS service is working fine after DNS.

My problem now is that when I use static IP configuration DNS is not working.

How can I change the DNS server address at runtime?

Best regards,

Óscar.

0 项奖励
回复
1,126 次查看
oscargarciaabad
Contributor III

Hi,

This is answered on the link Garabo posted, the solution is ipcfg_add_dns_ip().

I'm going to use it.

Best regards,

Óscar.

0 项奖励
回复
1,127 次查看
matthewkendall
Contributor V

Generally the DHCP server will give you a DNS server address (in addition to your own address, the netmask and the default gateway address), so you don't have to do anything.

The list of things that the DCHP server gives you is flexible and is generally configurable on the server, but DNS server address is almost always included in the list.

0 项奖励
回复
1,126 次查看
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Oscar,

Take a look to this thread: Re: How to read active ethernet configuration in MQX 3.8?


Regards,
Garabo

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------