민서네집

Samba 서버에 IP 번호 대신에 host 이름으로 접근하려면 본문

LINUX

Samba 서버에 IP 번호 대신에 host 이름으로 접근하려면

브라이언7 2016. 12. 2. 16:49

How can I connect to a Samba server using its hostname instead of the IP?

http://askubuntu.com/questions/243461/how-can-i-connect-to-a-samba-server-using-its-hostname-instead-of-the-ip



11down voteaccepted

There are a couple of issues that could lead to this:

  1. Enabling Netbios in your samba configuration file

    in your /etc/samba/smb.conf file, after the WORKGROUP line, add the following:
    netbios name = PC_NAME Where PC_NAME is the name of your PC as it will show in the network. Then reset the samba service sudo service smbd restart

  2. Not having STATIC IP

    Need to have static IP set in order for other PCs on that network to see you. This also depends on your router and the configuration of your network.

  3. Hostname length should be less than 15 characters

    If your hostname is longer than 15 characters it will give an error in some cases. Type hostnameto see your hostname. To change it you can either:

    sudo sysctl kernel.hostname=NAME

    or you can edit the /etc/hostname file and reboot.

  4. In the /etc/samba/smb.conf file, look for the line that says the following:

    # What naming service and in what order should we use to resolve host names
    # to IP addresses
    ;   name resolve order = lmhosts host wins bcast
    

    Uncomment the line that says name resolve order and make sure that bcast is the first on in the list, should look like this afterwards:

    name resolve order = bcast lmhosts host wins

    Then restart the Samba service as I mentioned above.

This is all assuming it is Ubuntu the problem, you have already Samba installed and you are not working through Active Directory.

In many case it is also Windows. You would need to do stuff like flush the DNS and the register to it. On Windows in the terminal (cmd) do the following:

ipconfig /flushdns
ipconfig /registerdns

You need to reboot the PC afterwards. After this, check to see if you can see the Ubuntu PC by doing for example net view in Windows.


Comments