[SOLVED] [alpine linux] resolving ip address on a local network using hostname
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[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.
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.