LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-18-2023, 06:44 AM   #1
pooya_sh
LQ Newbie
 
Registered: Aug 2023
Posts: 1

Rep: Reputation: 0
[alpine linux] resolving ip address on a local network using hostname


Hi first of all I should mention that this is my first post so please tell me if I'm making any mistakes.

I'm currently trying out an alpine linux virtual machine to possibly learn a little more about it and experiment with the environment it provides. Since It's a minimal os there is no graphical output so I either have to use the console or ssh to it. However, when using ssh I have to find the local ip address that is assigned to it every time which seems to be set by virt-manager or qemu.

My question is can I somehow use the hostname of vm (which is consistent) to ssh to it? After searching a little I think what I'm looking for is a service called avahi that provides something called mdns. I don't have any experience with networking so I just installed the service without any configuration but it didn't work and after some more searching I realized that it's because alpine uses musl c library and musl doesn't implement mdns so it doesn't work. since the avahi package is in alpine repos I'm pretty sure there must be a way to get it to work but I haven't found any solutions to it.

Sorry if it appears that this problem strays from networking. My original question remains the same, using hostname instead of ip address to ssh to a vm so if there is any solution that doesn't involve the above method that would also be awesome.
 
Old 08-18-2023, 08:24 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,859

Rep: Reputation: 161Reputation: 161
The easy way:
1) Connect to your Linux machine through console. It does not request IP address.
2) Find out the new IP address of Linux machine
3) SSH in.
 
Old 08-19-2023, 04:03 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,763

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Configure the IP address of the vm to be static.
Then update the hosts file on the connecting computer
(Figuring out how to do that will be a good learning experience)

Last edited by scasey; 08-19-2023 at 04:08 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CUPS (ALPINE) - CUPS claiming print job completed despite printing nothing, How to debug the issue? (network printer, Alpine, Linux, Docker) vinnu543 Linux - Newbie 2 11-01-2018 03:18 PM
CUPS (ALPINE) - CUPS claiming print job completed despite printing nothing, How to debug the issue? (network printer, Alpine, Linux, Docker) vinnu543 Linux - Networking 1 11-01-2018 03:13 AM
HOSTNAME = hostname -> HOSTNAME: command not found ? thomas2004ch Linux - Software 2 08-26-2013 08:25 PM
sarg and resolving an IP address to a Hostname Wynand1 Linux - Networking 3 05-10-2006 05:00 AM
/etc/hosts resolving before DNS resolving ? markraem Linux - Networking 4 11-02-2003 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration