Auto Connect to Internet With DHCP Client - MikroTik Script RouterOS

The MikroTik RouterOS DHCP client may be enabled on any Ethernet-like interface at a time. The client will accept an address, netmask, default gateway, and two dns server addresses. The received IP address will be added to the interface with the respective netmask. The default gateway will be added to the routing table as a dynamic entry. Should the DHCP client be disabled or not renew an address, the dynamic default route will be removed. If there is already a default route installed prior the DHCP client obtains one, the route obtained by the DHCP client would be shown as invalid.

Add a DHCP client on ether1 (example: ether1 is a WAN/ISP) interface

/ip dhcp-client add interface=ether1 disabled=no