How old is your dog, and does he have any other symptoms?
OK start with his feet. Check them with a magnifying glass. See if there is anything, either in the pads, or between the pads, anything stuck there or even a very tiny thorn. Don't just look....feel with your fingertips too. Feeling the pads can often tell you a thorn is stuck there, which you might not ba able to see.
If you find some tiny thorn. Bathe the pad with warm water a while, then remove the thorn in one complete piece with tweezers, then bathe with antiseptic. Then check the toenails, in case one is torn or split. Hopefully it is embedded thorns. That is a quick and easy solution! (of course if you find anything you can't get out, then the vet will have to do it.)
If that turns up nothing, feel along each leg, gently but firmly, starting at the foot, and working up to the shoulder joint (or hip joint in back leg) Watch your dog carefully for any wincing, or discomfort while you do this. You may find the source of the pain.
It would also be good to go to the vet. This could possibly be caused by a spinal problem.