Table of Contents
Example configurations
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 <code> 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
/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
/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"