"504 Gateway Time Out" is but a variation of "DNS not found" (ie the timeout implies not found).
First ping the ISP Gateway address; you can't get to anything without access to it.
Then ping the DNS addresses one at a time (there should be two).
It is not necessary to always use your ISP's DNS; I have roadrunner.com but use
the OpenDNS (208.67.222.222) and Google's DNS (8.8.8.8) in that order.