Hostname instead of ip

Hojland

Member
Join Date
Oct 2006
Location
Langå
Posts
203
I would like to give my 1769-L16ER a hostname instead of an ip adresse. I have set it to DHCP an giving it hostname US12345 but I am not able to ping it. Have any of you tryed this before. I need a guide how to do this
 
DHCP server doesn't handle names. It only assigns IP address. It's the job of a DNS server to handle the host name to IP work.

It's rare in control network to have such a setup with DHCP server and DNS server, which typically means you are in a domain environment.

More typically, you are in a Workgroup. Which means you set up static IP address for devices then if you want, modify the host file on individual PC so you can use host name instead of IP address.

ETA: senior moment. Correction: DHCP does care about name, it look at the host name then assign an IP address to it. You need to see if the PLC successfully got the IP assigned properly by the DHCP server.
 
Last edited:
I would like to give my 1769-L16ER a hostname instead of an ip adresse.

If your device is on the network, it's going to have an IP address. Your hostname doesn't provide any benefit if other devices can't resolve it to an IP address.

I have set it to DHCP an giving it hostname US12345 but I am not able to ping it.

Have you set up the DHCP server? By setting it to DHCP you are telling it to wait for a DHCP server to assign it an IP address. Until it has an IP address, nothing can communicate with it.

If you don't have a DHCP server, you'll have to set a static IP address.

Once the device has an IP address, a DNS server does the work of matching your use of the hostname to the actual IP address. If you don't have a DNS server you may be able to manually add a lookup value (eg in Windows you would edit your hosts file).
 
A DHCP server is often a gateway or a NAT router; NAT routers are usually provide a proxy for DNS.


For example

  • A typical residential NAT router, say at 192.168.1.1 on a LAN network of 192.168.1.0/24, will be configured on its WAN (internet-facing) side to "know" the IP addresses Preferred Internet DNS servers; those DNS servers are usually supplied by the ISP (Internet Service Provider);
  • On the LAN side it then tells its DHCP clients (192.168.1.2 to 192.168.254])to use itself i.e. 192.168.1.1 for DNS requests. However, any resulting DNS requests from the LAN side will be forwarded to the WAN DNS servers i.e. the NAT router becomes a proxy for the internet DNS servers.
Not all routers work like this; sometimes it is the DHCP client that sets up 127.0.0.1:53 (localhost port 53) as a DNS service.


But even if it is not done that way, the point is that DNS requests go through the router, which could unpack the request and decide if the request could be satisfied from information in the DHCP server i.e. as @harryting notes, the DHCP server can map names to the IP addresses it serves, and if a host on the LAN makes a DNS request that the router's local DHCP server can handle, the router may simply answer the request without asking The Internet DNS Servers.


Update: anyway, most routers have a web server, and allow you to browse the router's DHCP server's client table, where you will see the names; it may even be possible to assign a name to a given IP address (actually it is assigned to the MAC address, but that ends up being the same thing).
 
Thanks for trying to explain it for me.
Maybe I should try to explain it in another way. I would like to put my plc on my network and connect it with a name instead of an ip adress eg 10.25.250.xxx If I move it to another network eg 10.3.250.xxx i would like it to still respond to the name without changing any ip adress. Can it be don?
 
Is this something that needs to work from just a single PC or does this need to work amongst all the devices on the network?

If all devices need this capability, then you'll need a DNS (Domain Name System) server to accomplish this. Your company likely has a DNS server so your IT folks would need to know the specific IP addresses and names to be used. Maybe even the MAC addresses.

If this just needs to be accomplished from one PC then look into the "Hosts" file. Google it. This is a file on your own PC that translates names to IP addresses.

But the Hosts file isn't automatic, or dynamic. You have to manually update it. If a device IP address changes, you would have to remember to change the HOSTS file too.

OG
 
Thanks for trying to explain it for me.
Maybe I should try to explain it in another way. I would like to put my plc on my network and connect it with a name instead of an ip adress eg 10.25.250.xxx If I move it to another network eg 10.3.250.xxx i would like it to still respond to the name without changing any ip adress. Can it be don?

You do not use a name 'instead of' an IP address. Any device on a network will have an IP address. A hostname essentially serves as a translation of an IP address into a more human-readable format, this translation being done by DNS/hosts file/whatever. In reality the IP address is what your computer is using, the hostname is just a convenience for you.

When you move the PLC from one network to another, its IP address will have to change.* In order to continue for the hostname to connect to the new address, whatever you're using for DNS has to update to use the new IP address. As OG notes, if these networks are part of your company's network with a DNS server it can probably be set up to work the way you'd like. If they are isolated networks without, the Hosts file will translate a hostname to an IP address, but you'll have to update it any time the IP address changes.

*unless the two networks' addresses overlap and the one you're using falls within both
 
Thanks for trying to explain it for me.
Maybe I should try to explain it in another way. I would like to put my plc on my network and connect it with a name instead of an ip adress eg 10.25.250.xxx If I move it to another network eg 10.3.250.xxx i would like it to still respond to the name without changing any ip adress. Can it be don?

Yes. However, I suspect it's more trouble than it's worth.

I also suspect that you do not have a DHCP server. Most control network doesn't have one or they only use "bootp" server which is similar to DHCP. But bootp server=static IP and DHCP=dynamic IP.

bootp = assign this IP, YYY, to this device named XXX. Always.

DHCP = assign one of many IP to a device that's asking for an IP.

If both of the network got a bootp server and they both have the PLC in their database, then yes, it can work. ETA: you would still need to update your PC's host file when you change the PLC to a different network in that case.


DHCP is whole different ballgame.

https://docs.oracle.com/cd/E19253-0...e a DNS mapping is,is assigning to the client.
 
Last edited:
I do have a dhcp server. But I can not ping US12345 I can ping 10.0.47.53 with no problems
Se attacment

host.PNG
 
Last edited:
Some, and probably most, DHCP servers, e.g. typical residential NAT routers, do have the ability to assign static IP addresses to specific devices (each device has a unique MAC address) e.g. I do that with my home printer so it is always found at the same IP.


It appears OP is assigning the host name at the controller, but either their DHCP server is not picking up on it, or the name:IP mapping is not getting into their name resolution scheme (typcially DNS; Domain Name Server). Note that it is hosts other than the controller that need to map the name to the IP, and those hosts get that information either from DNS or their own local hosts file.
 
It seems this discussion has gotten slightly off track with mentions of DHCP and BOOTP. While those tools might have an ability to assign a host name along with an IP address (and the address for a DNS server), that doesn't do any good if there is no way to resolve the names back to IP addresses. That appears to be where our OP is right now. He has assigned a host name but cannot get it to resolve to an IP address (fails ping). He is missing the ability to perform host name resolution.

This requires a Domain Name System (DNS) server if you want all devices on the network to be able to use the names. There are switches (managed) and routers with the ability to act as DNS servers, but I've never used it on either of those. I've always set it up as part of a Windows server.

Or you can setup the hosts file so that a specific PC can use names. But as was mentioned this is a static file on your PC that would have to be updated manually anytime there are changes.

A DNS server updates periodically on its own, or your DHCP server can be configured to dynamically update the DNS whenever it assigns an IP address to a device.

While I understand the reason behind this request, I suspect it is more trouble than it is worth.

OG
 

Similar Topics

Hi, Has anyone figured out how to access a PLC via a hostname in Kepware rather than it's IP address. You can do it in Linx but the Kepware ID...
Replies
14
Views
12,209
A new point I/O rack is to be hooked up with the running PLC. In point I/O, it is supposed to be the OA4 card to be installed as per the...
Replies
1
Views
76
Hello, I was wondering if anyone has some insights into a VFD controls scenario. We have a VFD controlling a pump which is currently setup so that...
Replies
25
Views
3,198
Hi Guys, what could cause HMI Button names in runtime to be showing 'text' instead of their real names. (TIA Portal - Comfort Panel)? I will...
Replies
4
Views
1,606
Hello i have two problems currently. I have two screens and when i want to scroll between them i just press the down button and it just goes to...
Replies
3
Views
1,041
Back
Top Bottom