When i try to connect in Finder to SMB share with hostname URL (like smb://hostname.synology.me linked to my IP) i can't access, but if i put my local IP, i can access.
How i can connect with hostname?
You'll need to have / run a DNS server or modify your local hosts file to have the names resolve properly. Or you'll need a service to do this for you - Apple's Find My Mac service through iCloud is but one option there.
If you go the host file or DNS option, from terminal, use the host command to see what is resolving:
You might be able to get bonjour to work as well. This is more complicated - since the host tool and some others don't handle bonjour well.
List the SMB mounts that bonjour has found on the local network:
dns-sd -B _smb
You need to use control + C to cancel the browse command. Take the names at the end of the listing and put them in quotes if they have spaces or other punctuation in the names. Get the local name for the service:
dns-sd -L "Epson Stylus NX430" _smb
That will show you the bonjour name and what local host name and port to communicate to the SMB server in question. Here's the output of the above command since it's a bit dense to read the first few times you try this "trick".
mac:~ me$ dns-sd -L "Epson Stylus NX430" _smb Lookup Epson Stylus NX430._smb._tcp.local DATE: ---Sat 14 Nov 2015--- 9:39:36.912 ...STARTING... 9:39:37.471 Epson\032Stylus\032NX430._smb._tcp.local. can be reached at Epson.local.:445 (interface 4)
So, in the above example. The host name is Epson.local which you would substitute for smb://hostname.synology.me as smb://Epson.local