Access linux machine by hostname within LAN?

278

Solution 1

windows hosts are accessable by name because they can be found by their netbios name http://en.wikipedia.org/wiki/NetBIOS

For your linux box you can:

  • Add a dns server
  • Install samba and configure it to use netbios name
  • Add ip/name of your linux machine to other box in your lan (/etc/hosts if linux, c:\windows\system32\drivers

Solution 2

If you run Samba on the Linux box, you should be able to access the Linux box from the Windows boxes, by using the Linux box's hostname.

(There is a lot more to it than that, but that's the simplest solution)

Solution 3

I'm going to assume you're using DHCP, and that the clients are sending their hostname to the DHCP server, which is updating a local DNS server (try nslookup ${somehostname} to verify the server address).

CentOS5 does not, AFAIK, send the hostname over DHCP by default. Add:

DHCP_HOSTNAME=${yourhostname}

to /etc/sysconfig/ifcfg-eth0.

If it's a static IP, see the hosts file, dnsmasq, BIND, or some Windows-based DNS server. Caveat: your router is probably functioning as a DNS server, so you'd need to make some client configuration changes if you set up a local DNS server in order to have them look at it first.

Solution 4

I think, there are two options:

  • Manually creating an /etc/hosts and distributing it on the different machines (takes a lot of maintenance), see http://en.wikipedia.org/wiki/Hosts_%28file%29

  • locally installing a small DNS server, e.g. dnsmasq. dnsmasq can also work as a DHCP server and will include the hostnames that it records via DHCP in its DNS replies

Maybe, the AT&T box also has some local DNS features? I don't know that box, though.

Solution 5

A bit old here but i answer anyway :

[global]
  workgroup = smb
  netbios name = SERVEUR
  security = share
  share modes = yes

[homes]
  comment = Home Directories
  browsable = no
  read only = no
  create mode = 0750
Share:
278

Related videos on Youtube

Travis Beck
Author by

Travis Beck

Updated on September 18, 2022

Comments

  • Travis Beck
    Travis Beck over 1 year

    IM having trouble accessing the ->metadata of a path when the path has a space in one of the folder names. So if the path is /CLIENT/FOLDER NAME then the metadata call returns 401. I am encoding the path parameter like so:

    $path = str_replace('%2F', '/', rawurlencode($path));
    

    which adds %20 for spaces. If i go into dropbox and change the "FOLDER NAME" to "FOLDER-NAME" everything goes through just fine. Is there another way I should be encoding the path?

    Heres more code preceding Im drilling down into folders and passing the preceding folder path as a querystring 'path' so the url im having problems with is "/my-hub/?path=COMM%20POLICIES"

       $clientpath = "/DACLIENTS/$username";//username is the current user
       $path = $clientpath;
       if(isset($_GET['path'])){
          $path .= '/'.rawurldecode($_GET['path']);
       }
       $path = rawurlencode($path);
       $path = str_replace('%2F', '/', $path);
       // List contents of directory
       if ($home = $client->metadata($path)) {
           ...
       }
    
    • Rizier123
      Rizier123 over 9 years
      Also i think this is enough: $path = rawurlencode($path) i think you don't have to do the str_replace()
    • Demodave
      Demodave over 9 years
      @Rizier123, No, because you don't want to encode the /'s
    • Demodave
      Demodave over 9 years
      What version of dropbox-php are you using? @Travis Beck
  • Admin
    Admin almost 13 years
    It is Netopia 3000. If it helps. I could not find anything useful though about this box, which can help me.
  • user766453
    user766453 almost 13 years
    I am getting "server can't find ${yourhostname}: NXDOMAIN" error. Although this command does display the router IP correctly. Also, DHCP_HOSTNAME is also set correctly in /etc/sysconfig/networking/devices/ifcfg-eth0.
  • OutputLogic
    OutputLogic over 12 years
    Installing samba did solve the problem.
  • Lukasz
    Lukasz over 11 years
    I Found this to be the most reliable and efficient solution if you are using your own DNS server (we use DNSmasq). This eliminates need for any external packages to enable name resolution even from Windows hosts. By the way this is what I put into our config: DHCP_HOSTNAME=$HOSTNAME
  • Travis Beck
    Travis Beck over 9 years
    I've tried that as well, doesnt work. If i dont encode the path, I get an exception.
  • PressingOnAlways
    PressingOnAlways over 9 years
    What is the exception? Can you post more code - you show how you are replacing the string, but you don't show exactly what call is creating the error.