Getting default gateway address after DHCP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting default gateway address after DHCP

Jump to solution
637 Views
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 Kudos
1 Solution
395 Views
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.

View solution in original post

0 Kudos
4 Replies
395 Views
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 Kudos
395 Views
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 Kudos
396 Views
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 Kudos
395 Views
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!
-----------------------------------------------------------------------------------------------------------------------