Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Hostid changing with network

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
prestige787
n00b
n00b
Posts: 40
Joined: Sat Sep 18, 2021 10:01 pm

Hostid changing with network

  • Quote

Post by prestige787 » Fri Oct 28, 2022 2:53 pm

I'm having a problem where when I use my laptop on a different newtork, the hostid changes. More specifically, when I connect to a wpa2 enterprise network, the hostid becomes 00000000 (found with "hostid" command). On my home network the hostid is very different (still 8 characters though). As far as I know hostid should change only if the hardware changes, not the network you connect to. This is a problem for me as some software I need checks the hostid to validate the license. Is there any way that I can prevent the hostid from changing? I believe I followed the handbook exactly for network setup (dhcp).
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Fri Oct 28, 2022 3:56 pm

What led you to think that the hostid is hardware related? As I read the documentation in man hostid, it has a decent chance of being the IPv4 address of your current hostname, if that is resolvable. That can easily change as you roam networks, so any license locks keyed to it are just defective. They should not be relying on that identifier for anything. Fortunately, according to man gethostid (referenced from man hostid), glibc can get an administrator-chosen hostid from etc, so you should be able to set the hostid to whatever value your broken licensing scheme wants to see.
Top
mike155
Advocate
Advocate
Posts: 4438
Joined: Fri Sep 17, 2010 11:33 pm
Location: Frankfurt, Germany

  • Quote

Post by mike155 » Fri Oct 28, 2022 5:09 pm

You could fake the hostid. Create a program '/opt/fake_hostid/bin/hostid':

Code: Select all

#! /bin/bash
echo "1bac013d"
Start the program that calls 'hostid' to check the license with:

Code: Select all

PATH="/opt/fake_hostid/bin:$PATH" yourprogram
Top
no101
n00b
n00b
Posts: 19
Joined: Mon Oct 10, 2022 4:03 pm
Location: Piney Woods
Contact:
Contact no101
Website

  • Quote

Post by no101 » Fri Oct 28, 2022 7:02 pm

if /etc/hostid exists, hostid(1) and gethostid(3) will read from that file instead. sethostid(3) will write to that file.

This is a trivial program to write the existing result of gethostid() into /etc/hostid. Run it on a working machine and then when you switch the network, hostid should still return the old id.

Code: Select all

#include <stdio.h>
#include <unistd.h>

int
main()
{
	if (sethostid(gethostid())) {
		perror("sethostid");
	}
}
Save that as save_hostid.c and compile it with

Code: Select all

gcc -o save_hostid save_hostid.c
Only root can execute the sethostid() command so it has to be run as root. You only need to run it once to generate the file, then switch networks and things should just work. To undo the forgery, just remove /etc/hostid.

Note: you should never just blindly run code off the internet so you can check what that code does with

Code: Select all

man 3 sethostid
man 3 perror
Top
prestige787
n00b
n00b
Posts: 40
Joined: Sat Sep 18, 2021 10:01 pm

  • Quote

Post by prestige787 » Thu Sep 21, 2023 2:50 pm

Ok it's been a while but I still have not fixed this issue. I believe the root cause is related to this:

https://support.spirent.com/SpirentCSC/ ... d=SOL11499

I've tried a bunch of solutions I found online but none fix the problem.

The ifconfig command has the loop back first, and the actual card second. Is there any way to change this?
Top
grknight
Retired Dev
Retired Dev
Posts: 2564
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Sep 21, 2023 3:03 pm

https://support.spirent.com/SpirentCSC/ ... d=SOL11499:
FLEXnet license manager only understand network interfaces starting with ethX and with network interface names like emX, pXpX, virbrX will return a null MAC address.
This means only ethernet is supported and wireless is not mentioned as available (can be a dumb program). As well as the net.ifnames=0 kernel command-line option needs to be included.
prestige787 wrote:The ifconfig command has the loop back first, and the actual card second. Is there any way to change this?
This is nothing that is relevant as you can't change it.

If the hostid is changing after connecting to wireless, then, before it is connected, if hostid command gives a valid answer, write it to the file /etc/hostid and it will always be read from there.
Top
prestige787
n00b
n00b
Posts: 40
Joined: Sat Sep 18, 2021 10:01 pm

  • Quote

Post by prestige787 » Thu Sep 21, 2023 4:47 pm

I am actually on wifi both times, not connecting to ethernet at all on this particular machine. I have already used a fix provided in this thread to get the hostid command to return a non zero value, however even with net.ifnames=0 set,

Code: Select all

./lmutil lmhostid
returns all zeroes (this is the binary tool the program uses to get the flexnet hostid) on the enterprise network, but on my home networks it returns a non zero value, so it must rely on something other than hostid.
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Sep 28, 2023 11:18 pm

For future readers, note that prestige787 opened an additional thread on this topic as Maple17. Given how this thread has gone to date, I am not inclined quite yet to merge the two threads, though I could be convinced to do so. For now, I am settling for posting cross-links in each thread so readers can find both of them.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic