How can I configure my virtual machines using hostroutes?

Example configuration

In the following examples we assume that the following IPs are used:

IP Host: 10.0.1.100/24
IP Gateway: 10.0.1.1
IP VM: 10.0.2.100/32


Host-configuration

In your virtualizing software you need to create a bridged setup for your virtual machine. On VMware vSphere your vSwitch needs to be "connected" to the NIC of your server. When using most other virtualization environments, like Proxmox or Solus VM, this is default when you chose bridged-setup.

VM-configuration

the base-installation needs to be done offline from an installation-medium, because installers usually do not allow the setup which is needed. After installation hostrouting can be configured using configuration-files:

Debian/Ubuntu

On Debian or Ubuntu you need to setup the NIC of your virtual machine as follows:

/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 10.0.2.100
	netmask 255.255.255.255	pointopoint 10.0.1.1
        gateway 10.0.1.1

CentOS

On CentOS network is configured in /etc/sysconfig/network-scripts. Two files need to be created here. Notice, that also the MAC-address of your NIC (see "ifconfig")


/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:11:22:33:44:55"
IPADDR=10.0.2.100
NETMASK=255.255.255.255
NM_CONTROLLED="no"
ONBOOT="yes"
SCOPE="peer 10.0.1.1"
GATEWAY="10.0.1.1"
/etc/sysconfig/network-scripts/route-eth0
default via 10.0.1.1 dev eth0

 

openSUSE

on openSUSE two files need to be created as well, 

/etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static'
STARTMODE='auto'
NAME='82540EM Gigabit Ethernet Controller'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.2.100/32'
MTU=''
NETWORK=''
REMOTE_IPADDR=''
USERCONTROL='no'
/etc/sysconfig/network/routes
10.0.1.1 - 255.255.255.255 eth0 
default 10.0.1.1 - eth0

FreeBSD

sorry, for explaiOn FreeBSD, everything can be setup in /etc/rc.conf:

/etc/rc.conf
interface_re0="inet 10.0.2.100 netmask 255.255.255.255"
static_routes="gateway default"
route_gateway="10.0.1.1 -iface re0"
route_default="default 10.0.1.1"

Windows

Windows saves the right configuration after issuing the following command (notice, that "Local Area Network" might be localized):

netsh interface ip set address name=“Local Area Network“ static 10.0.2.100 255.255.255.255 10.0.1.1 1

You can also use the configuration-assistant, but you will get a warning when applying configuration - this warning can be ignored, setup will work. 

 

Was this answer helpful?

 Print this Article

Also Read

IPv6 (Internet Protocol Version 6)

he old IPv4 protocol supports 4,3 billion addresses for the world wide web. IPv6 was developed by...

Root Password reset via Rescue (Linux)

To reset your root users password via the rescue mode, follow this instructions:1.) Set your...

How to work with the rescue system?

Our rescue system is compareable with Debian. Any basic Linux commands can be used. Activate...

How to install an own operating system image without a hardware KVM over IP?

If you want to install an own image, for example to prepare your own partition set, you can do...

Linux

When using a software RAID, it is necessary to check for proper functionality, since in case of...

Powered by WHMCompleteSolution