No, running a dns reverse lookup is not illegal. There is no problem in taking an IP address and finding the domain name behind it. However, you shouldn’t take unethical measures to find the IP itself.