How can I configure my virtual machines using hostroutes?
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
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.
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:
On Debian or Ubuntu you need to setup the NIC of your virtual machine as follows:
/etc/network/interfacesauto 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
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-eth0DEVICE="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-eth0default via 10.0.1.1 dev eth0
on openSUSE two files need to be created as well,
/etc/sysconfig/network/ifcfg-eth0BOOTPROTO='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/routes10.0.1.1 - 255.255.255.255 eth0 default 10.0.1.1 - eth0
sorry, for explaiOn FreeBSD, everything can be setup in /etc/rc.conf:
/etc/rc.confinterface_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 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?
When using a software RAID, it is necessary to check for proper functionality, since in case of...
Our rescue system is compareable with Debian. Any basic Linux commands can be used. Activate...
he old IPv4 protocol supports 4,3 billion addresses for the world wide web. IPv6 was developed by...
If you want to install an own image, for example to prepare your own partition set, you can do...