Jump to content
Fancy running a forum? Sheffield Forum is for sale! Learn more
Sign in to follow this  

Using A Name Rather Than Number For Ip On Local Netowk

Recommended Posts

I need some kind of fixed IP address for a device on my local network. Currently, my router assigns IP addresses (DCHP) and it can be different for any given device on any given day.

 

I know it's possible to manually set an IP, rather than use DCHP, but is it also possible to set a name; for example:

 

Rather than 192.168.1.3/some/folder/

Can I have something like my_device/some/folder/

 

Thanks.

Share this post


Link to post
Share on other sites

you need to set the IP address on the device.  you might want to check your router configuration to make sure you exclude the IP address you set from the pool it allocates DHCP addresses from. 

 

The other devices will have a hosts file, c:\Windows\System32\Drivers\etc\hosts. on windows, /etc/hosts on Linux and similar devices. 

 

If you open this file with notepad or similar you need to add a line something like

192.168.1.3      what_you_want_to_call_the_device

 

Share this post


Link to post
Share on other sites

Ah, think I've edited a hosts file before, on a Mac.

 

If I set a hostname on my Linux machine, will other devices on the network still find it (using the hostname)?

Share this post


Link to post
Share on other sites

Yes...

By default, windows machines have a name like DESKTOP-CX5408jks or something random like that, if you haven't set your own this will point to the relevent PC..

on linux yes, if you set a hostname, this will be what other devices use to get to that machine...

be aware though that using DHCP with hostnames, could result in errors, depending on how the other machines cache the entries/names etc.... you should always try and use static ip's where possible :)

Share this post


Link to post
Share on other sites

As above really.

 

Name the PC

Static IP (fill in the other parts:- subnet, default gateway and DNS servers you want to use)

 

Basic example...

192.168.1.10 (double check the first 3 sets of numbers)

255.255.255.0

1.1.1.1

1.0.0.1

 

I'm not trying to be patronising with the example, not sure how much you know about it 😉

 

It can take time to start working, even on a home network. I've also had issues with Linux on this. I've not tried on my new kit but for some reason it wouldn't play nice with Windows or macOS the last time I tried. That was about a year ago. In these boring times it might be time to put Linux on my Z87 system and see how Linux is coming along.

 

Share this post


Link to post
Share on other sites
18 hours ago, Waldo said:

Ah, think I've edited a hosts file before, on a Mac.

 

If I set a hostname on my Linux machine, will other devices on the network still find it (using the hostname)?

I presume you are using Samba for the file sharing across the network. You need to use WINS, on the server you need to set the netbiois name in the smb.conf file. Restart the services and name resolution should work with windows clients.  For linux and similar clients you will probably have to still edit the /etc/hosts file. 

 

I've always found it easier, and less pain when troubleshooting, just to edit the hosts file on each client. It's 5 minutes per client and generally works and recovers after a mishap with little pain.

Share this post


Link to post
Share on other sites
7 hours ago, andyofborg said:

I presume you are using Samba for the file sharing across the network. You need to use WINS, on the server you need to set the netbiois name in the smb.conf file. Restart the services and name resolution should work with windows clients.  For linux and similar clients you will probably have to still edit the /etc/hosts file. 

 

I've always found it easier, and less pain when troubleshooting, just to edit the hosts file on each client. It's 5 minutes per client and generally works and recovers after a mishap with little pain.

You shouldn't EVER need to edit the hosts file imho...

Unless you're blocking/blacklisting some sites/IP's... but for simple internal name resolution it shouldn't be needed at all...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.