IIRC, even if you use an IP address as the hostname, you still have to make sure that it exists in your Hosts (in Internet prefs and consequently in the SYS:Devs/Internet/hosts file).
Also, make sure you have the network up before executing tyhe script, i.e. if you are running it during startup, call it from the bottom part of your S:Network-Startup script.
(talking OS4 here, of course; if you're on anything lower, the principles are the same, but you have to work out the equivalents yourself :-)).
Best regards,
Niels