I have transmission configured on my raspberry and I use two android app to search/download torrent.It works very well.
The problem is that I should use always the ip.
In general it does not change but sometimes it does.
So I thought to register an hostname to dhcp server of my router.
I configured the file:
and I wrote:
send host-name “raspberry”;
but it does not work. Is there something else I can do?
I noticed that hostname command return “osmc”, where this value is retrieved?
What about domain
I copied the smb.conf file from /etc/samba/ to the same directory and named it smb-local.conf and then edited it. Make sure the workgroup is the same, and add the lines “netbios name = raspberry” and “server string = raspberry” (I usually add them directly below the workgroup line) then save and close.
Next edit the smb.conf file and make sure the line “config file = /etc/samba/smb.local.conf” is there at the top.
I think here is the misconcept. to Have your android app be able to access your OSMC you would need your DHCP/DNS server know about it and tell ot the android app. So you really have to check your DHCP/DNS server to do this correctly/
Try my post above. I have a dd-wrt router with static ip’s assigned with hostnames and DNS still didn’t resolve the hostname until I added those lines in the smb-local.conf file. Make sure every location stated previously used the same device name as well.
I also hit my 5 pi’s by hostname on my android devices using this method.
@fzinken: “His question is not about SMB but just plain DNS resolution” I know that, but adding those settings helps with DNS resolution for some reason.
No. This does not solve the issue. If Dhcp server assign a different IP (sometime this occur) I have to change configuration. With this drawback it is better use directly the IP.
I am studying a solutIon. For the moment I noticed that doing ping osmc.local on raspberry it correct resolve the name asking for name resolution to my ruote.
When I try on windows machine it seems use my ISP dns server. I think I am close to resolution.
But why dont you set a static ip on the pi ? This way it will always have that ip. If you are afraid of IP conflicts with other machines in the house then do this:
Set your DHCP on your router to start giving IPs from (example) 192.168.1.10
Then set all the static IPs you want bellow that value. For example
PC - 192.168.1.2
Pi - 192.168.1.3
This way any new device that enters the LAN will get an ip above .10.
Then editing your hosts file will allow you to always have the proper ip assigned.
Not to mention that in the future if you ever want to have access to your pi from ‘the outside world’ you’ll be sure that protforwarding will work, since the router will always find the pi on the current LAN address
As suggested by Sanbird I reserved to Pi 192.168.0.5 and DHCP assign ip starting from 192.168.0.10.
In this way I solved part of problem. At least I know that Pi will have always same ip.
Looking at router webui (netgear) I see that 192.168.0.5 has associated the name osmc. In fact from raspberry I can ping 192.168.0.5. I cannot ping it from android e windows devices.
But where this name come from?
I finally understand that osmc does not use dhcp client but connman. I tried to search info but it’s not clear to me how it works. The only thing I know is that my windows machine ask for name resolution to isp dns and not to the router. I do not know how to configure my router.
Here you can see 2nd figure that is exactly like mine:
as you can see you can decide the dns ip. I have now “Get automatically from isp”.
Probably this is my first problem. Once this is solved I think I am able to use hostname from android w windows device.
wow…dont play with these
Your ISP ip must be set to automatic, unless you have a static ip provided by your ISP…In that case you put your static ip there.
This this simplest solution to your problem.
In ‘windows search’ search for Notepad, then right click on it, and Run as administrator.
Browse to location C:\Windows\System32\drivers\etc\ and open hosts file
At the bottom type the following 192.168.0.5 raspberry
Save and exit.
Open a browser and type: http://raspberry or any other program that you use to connect to the pi (putty, etc)
Just use raspberry instead of a local ip.
On your android device use a program like ES File Explorer
The hosts file is located at /etc/system
As said above I considered this thread as solved. I do not know how to set this flag.
I applied the workaround above.
However, I think my main issue probably is that my router does not work as DNS server. In order to have a private network with local address name, a router with DNS/DHCP server is necessary that resolve names.
When raspberry starts up it should send its name to router that assigned a whatever ip to it.
Whenever a client requires “raspberry.local” the ip is solved by router, for external names the resolution should be delegated to external ISP. This is how I expect a local DNS should works.