So if your vehicle has a gvw rating of 10k lbs or more and you engage in the act of commerce (making money) with it, you must have a federal dot #.
You dont need a cdl federally unless your gvw is over 26k lbs OR your trailer is over 10k lbs gvw. State wise, it varies quite a bit, states require a cdl at different levels but if youre traveling through one it defaults to your home state laws. If you travel to a state and work in it though, they require you to operate under their laws. Some have a grace period or grey areas but again it varies greatly by state.