adeguntoro
Posts: 87
Joined: Wed Sep 14, 2016 11:11 am

how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 2:16 pm

hey, i have 4 new RPi 3 model B..
3 of them is fine for hostname, but not with this one.
i try to change hostname, but it keep show 2 hostname, 1 for wifi and 1 for LAN..
cluster1 is LAN, and the another is wifi.
how to fix something like this ?without recreate image.
Image

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 2:57 pm

It looks like it is your router that is confused, not the Pi. Restart the router maybe..

Having two interfaces active on the same sub-net is usually asking for trouble, I don't know if you are actually making a cluster and have this under control.

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 3:03 pm

Who says that there are two host names ?

May sound like a strange question but it does make sense. You can not have two hostnames because the operating system only accepts one name, and this you can display with the hostname command.

Most likely: what you see is not a "hostname" but a name that has been recorded for an IP-address in the DNS of your router. It is difficult to analyze when/why it happened because DHCP can be involved.
Example: you configure the Pi with hostname1 and connect to the network using WiFi, in response DHCP assigns an IP-address to the MAC address with a lease time and DHCP registers the name and IP-address in DNS. Normally the registration will be deleted when the lease expires. If you disconnect the WiFi connection, change the hostname to hostname2 on the Pi (raspi-config. etc), and use an ethernet cable to connect a new IP-address will be assigned to the Ethernet MAC address and the name / IP address will be registered in DNS.

At this moment in time, as long as the lease on the WiFi MAC has not expired, the DNS will show two entries with different names and IP addresses.

DNS is a phone book with host names ( not hostname!) assigned to IP-addresses
DHCP is a registry of MAC addresses with IP-addresses.

What makes the situation different is that you changed the hostname, if you had not changed the hostname very likely the DNS entry would haven been overwritten with the new IP-address.

Note: did you notice that I used "host name" and "hostname" ? "hostname" is the name configured on the Pi, while "host name" is the name of the host as seen on the outside world. These must not be identical, sometimes must be different.

Please be aware that DHCP/DNS can be difficult to understand because there are many variations depending on the software used. Changing hostnames / interfaces can bring some confusion, normally it will get back to order when a lease expires.
The road to insanity is paved with static ip addresses

adeguntoro
Posts: 87
Joined: Wed Sep 14, 2016 11:11 am

Re: how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 6:16 pm

Ernst wrote:Who says that there are two host names ?

May sound like a strange question but it does make sense. You can not have two hostnames because the operating system only accepts one name, and this you can display with the hostname command.

Most likely: what you see is not a "hostname" but a name that has been recorded for an IP-address in the DNS of your router. It is difficult to analyze when/why it happened because DHCP can be involved.
Example: you configure the Pi with hostname1 and connect to the network using WiFi, in response DHCP assigns an IP-address to the MAC address with a lease time and DHCP registers the name and IP-address in DNS. Normally the registration will be deleted when the lease expires. If you disconnect the WiFi connection, change the hostname to hostname2 on the Pi (raspi-config. etc), and use an ethernet cable to connect a new IP-address will be assigned to the Ethernet MAC address and the name / IP address will be registered in DNS.

At this moment in time, as long as the lease on the WiFi MAC has not expired, the DNS will show two entries with different names and IP addresses.

DNS is a phone book with host names ( not hostname!) assigned to IP-addresses
DHCP is a registry of MAC addresses with IP-addresses.

What makes the situation different is that you changed the hostname, if you had not changed the hostname very likely the DNS entry would haven been overwritten with the new IP-address.

Note: did you notice that I used "host name" and "hostname" ? "hostname" is the name configured on the Pi, while "host name" is the name of the host as seen on the outside world. These must not be identical, sometimes must be different.

Please be aware that DHCP/DNS can be difficult to understand because there are many variations depending on the software used. Changing hostnames / interfaces can bring some confusion, normally it will get back to order when a lease expires.
okay, but when i connect my second RPi into my AP, i use same ip 192.168.1.160 and it show me different name, not Macbook-pro, but cluster3, just cluster3 and using dhcp..
and my laptop is off..
sorry for my bad english.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 6:27 pm

Do not use duplicate IPs on the same localnet. That will cause severe routing issues.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: how to fix 2 hostname for single RPi 3 model B ?

Tue Feb 21, 2017 6:51 pm

adeguntoro wrote:okay, but when i connect my second RPi into my AP, i use same ip 192.168.1.160 and it show me different name, not Macbook-pro, but cluster3, just cluster3 and using dhcp..and my laptop is off..
Don't use that pi with that ip address. Go into your router and find the part that sets the DHCP reservations. Make sure that they are all removed and then add in each one for each device and make each one different. Make sure all static devices are outside the range that the DHCP server in your router is providing. If this doesn't work, then you may have one of those routers that doesn't work right. Is it blue and does it say "linksys" on it?

adeguntoro
Posts: 87
Joined: Wed Sep 14, 2016 11:11 am

Re: how to fix 2 hostname for single RPi 3 model B ?

Fri Feb 24, 2017 7:55 am

SurferTim wrote:Do not use duplicate IPs on the same localnet. That will cause severe routing issues.
but this only happend with cluster1, i try wil cluster2 with same ip but not problem..

Return to “Troubleshooting”