How to configure Centos 7 to bind hostname to dynamic ip?

0

Hello.

I'm new to linux and I need to know first if what I'm looking for is possible.

The scenario is as follows, I have a notebook with windows 10 pro and in it I have a vm in hyper v with Centos 7. This vm was mounted using Vagrant. I am going to use this notebook to develop and test my projects that are php pages with database, for this I am configuring vm to have a web server. So far so good, I believe I can manage.

This notebook will be connected to many networks, at home, at work, etc. This is where I need your help. As they are different networks, different ips, I would like to be able to always connect via ssh / ftp from my note to my vm using only the hostname that for example will be 'centosvm'. I know there are ways to set the fixed ip or keep changing the ip for each network but that's not what I'm wanting, because in some networks I will not have access to the router to apply some specific rule. So what I need would be a way for my vm in centos 7 whenever it is connected to tie the ip that it takes to the hostname of it, and that I can see this machine through windows 10 being able to ping and connect via ssh / ftp using only the hostname 'centosvm'.

I have tried to use Avahi, but either something was missing or I configured it wrong or it does not do what I want, as I said I am new to Linux. Thanks for any help.

    
asked by anonymous 19.03.2018 / 11:57

0 answers