Setting up a guest VM to be accessed by devices on the real lan of the Host

Consider a VM called baby hosted in mother (the real machine) attached to lan family. Its services needs to be accessed by anyone of the lan  family. Moreover VM baby must access the outside world.

How to do it

On mother configure the network setting of baby as

Bridged with Replicate physical network connection state enabled.

On baby configure a static address.

Depending on the baby OS you should configure the network interface as follows:

For Debian distro….

Edit the file

vi /etc/network/interface.d/<interface_file>

<interface_file> represents the file for the configuration of the network) as follows:

iface ens32 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.254

baby shoud take IP 192.168.1.3 with gateway 192.168.1.254 on the lan family.

Remember to edit DNS resolution with

vi /etc/resolve.conf

setting the name server you want to query

nameserver 192.168.1.254

In this case the DNS server is the gateway.

For CentOS distro….

First, type “nmcli d” command in your terminal for a quick list of the ethernet card installed on your machine:

Type “nmtui” command in your terminal to open Network manager. After opening Network manager chose “Edit connection” and press Enter (Use TAB button for choosing options).

After restarting you should connect to the IP on the lan family.

 

Last words

Be carefull not to assing IPs on the family dhcp server slot, or you may experience some troubles during IP assigning.