Weird DHCP client address

Hi,

I have an internet provider who assigns a dynamic IP via DHCP client to my WAN interface.

When it gets the ip, it gets an IP like this:

/ip address print detail
2 D address=172.16.0.10/24 network=172.16.0.0 interface=wan1 actual-interface=wan1

/ip dhcp-client print detail
1 interface=wan1 add-default-route=yes default-route-distance=2 use-peer-ntp=yes status=bound address=172.16.0.10/24 gateway=172.16.0.1 dhcp-server= primary-dns=172.16.0.1 expires-after=59m20s

If i set dhcp-client to add a default route, it adds this route:

/ip route print
3 ADS 0.0.0.0/0 172.16.0.1 2

Note that the gateway automatically assigned is the gateway of the WAN1 interface, not the wan1 interface itself.

If i disable the option to add a default route and try to add a route manually, i would write a command like this (as i don´t know which IP it will get and which will be the wan1 gateway):

/ip route add dst-address=0.0.0.0/0 gateway=wan1 distance=2 disabled=no

But in this case (at least with this provider) it doesn´t work when i use wan1 as the gateway. With another provider, when i manually add a route using the wan interface as the gateway, it works.

Do someone have a clue about why is this problem happening and how to solve it?

Regards,

Fabiano

So far that i know, using interface as gateway will only work with on point to point interface such as pppoe, pptp

jackman is correct. The DHCP client can’t be chosen as an interface. This has been requested as a feature.

However I may be able to help you.
If you go to /routing filter and setup a dynamic in filter. It will apply those setting to the Dynamic route it creates when you choose add default route in your DHCP client.

CAUTION this is GLOBAL