Network Bridging

Introduction
Bridged networking can be used to configure your Virtual Machines. Some tweaking is necessary to make the network configuration work on our network.

Lines highlighted in yellow in the configuration examples keywords in capital letters that you must change for your own values. For example; IP_FAIL_OVER which you must change for your failover IP.

DEFAULT_SERVER_IP:
The primary IP of your dedicated server.
IP_FAIL_OVER: The Failover IP you want to configure
GATEWAY_VM: Your server IP with the last octet replaced by 254
Requirements
A dedicated server with an hypervisor installed (Ex: VMware ESXi, Citrix Xen Server, Proxmox, etc.)
Have assigned a mac to a virtual IP FailOver
Knowledge about SSH
Determining the gateway
To configure Virtual Machines, you need to know the gateway of your host machine (nsxxx; ksxxx ...). To do this, you must replace the last octet of the IP address assigned to your server with .254.


For example:

IP of your server : 123.456.789.012
Gateway’s IP is your server’s main IP ending in .254
So the gateway’s IP is: 123.456.789.254
Applying the configuration
Warning

The gateway you need to use in your virtual machine should not be, The IP of your dedicated server or IP failover but you must use the gateway provides for your dedicated server. You must in no case use:

route add default gw dev eth0
Otherwise you may cut your IP for the virtual server. To determine the correct gateway to use:

IP failover is: YYY.YYY.YYY.YYY
Main IP of your dedicated server: XXX.XXX.XXX.XXX
So the IP of the gateway for your virtual machine (GATEWAY_VM) : **XXX.XXX.XXX**.254
This gateway will be referred as GATEWAY_VM later in the guide.

Debian & derivatives (Ubuntu, CrunchBang, SteamOS...)
File: /etc/network/interfaces

 

  • auto lo eth0
  • iface lo inet loopback
  • iface eth0 inet static
  • address IP.FAIL.OVER
  • netmask 255.255.255.255
  • broadcast IP.FAIL.OVER
  • post-up route add GATEWAY_VM dev eth0
  • post-up route add default gw GATEWAY_VM
  • pre-down route del GATEWAY_VM dev eth0
  • pre-down route del default gw GATEWAY_VM
  • File: /etc/resolv.conf

1
nameserver 213.186.33.99 # DNS Server
Note

For Debian 6, dns server configuration is done directly in the file /etc/network/interfaces where you have to find this section:

# dns-* options are implemented by the resolvconf package, if installed (default)
dns-nameservers 213.186.33.99 # DNS Server
Redhat & derivatives (CentOS 6, Scientific Linux, ClearOS...)
File: /etc/sysconfig/network-scripts/ifcfg-eth0

 

  • DEVICE=eth0
  • BOOTPROTO=none
  • ONBOOT=yes
  • USERCTL=no
  • IPV6INIT=no
  • PEERDNS=yes
  • TYPE=Ethernet
  • NETMASK=255.255.255.255
  • IPADDR=IP.FAIL.OVER
  • GATEWAY=GATEWAY_VM
  • ARP=yes
  • HWADDR=MY:VI:RT:UA:LM:AC
  • File : /etc/sysconfig/network-scripts/route-eth0

 

  • GATEWAY_VM dev eth0
  • default via GATEWAY_VM dev eth0
  • File : /etc/resolv.conf


nameserver 213.186.33.99 # DNS Server
CentOS 7
Warning

For CentOS 7, the network adapter will vary depending on the installation. You will need to verify what is the adapter name and use it to configure your Virtual Machine. Use the command ipaddr to find your interface name.

File: /etc/sysconfig/network-scripts/ifcfg-(insert interface Name)

 

  • DEVICE=(insert interface Name)
  • BOOTPROTO=none
  • ONBOOT=yes
  • USERCTL=no
  • IPV6INIT=no
  • PEERDNS=yes
  • TYPE=Ethernet
  • NETMASK=255.255.255.255
  • IPADDR=IP.FAIL.OVER
  • GATEWAY=GATEWAY_VM
  • ARP=yes
  • HWADDR=MY:VI:RT:UA:LM:AC

Note

If the file route-(insert interface Name) does not exist, you’ll have to create it. For CentOS 7, NETWORK_GW_VM= Network of the GATEWAY_VM which is the main IP of your server where you replace the last octet by 0.

File: /etc/sysconfig/network-scripts/route-(insert interface Name)

 

  • GATEWAY_VM - 255.255.255.255 (insert interface Name)
  • NETWORK_GW_VM - 255.255.255.0 (insert interface Name)
  • default GATEWAY_VM

File: /etc/resolv.conf

1
nameserver 213.186.33.99
OpenSUSE
Note

For OpenSUSE, NETWORK_GW_VM= Network of the GATEWAY_VM which is the main IP of your server where you replace the last octet by 0.

If the file ifcfg-ens32 does not exist, you’ll have to create it.

File : /etc/sysconfig/network/ifcfg-ens32

 

  • DEVICE=ens32
  • BOOTPROTO=static
  • ONBOOT=yes
  • ARP=yes
  • USERCTL=no
  • IPV6INIT=no
  • TYPE=Ethernet
  • STARTMODE=auto
  • IPADDR=IP.FAIL.OVER
  • NETMASK=255.255.255.255
  • GATEWAY=GATEWAY_VM
  • HWADDR=MY:VI:RT:UA:LM:AC

If the file ifroute-ens32 does not exist, you’ll have to create it.

File : /etc/sysconfig/network/ifroute-ens32

 

  • GATEWAY_VM - 255.255.255.255 ens32
  • NETWORK_GW_VM - 255.255.255.0 ens32
  • default GATEWAY_VM

In /etc/sysconfig/network/config, you need to have:

 

  • NETCONFIG_DNS_STATIC_SERVERS=”213.186.33.99”

FreeBSD 8.0
File : /etc/rc.conf

 

  • ifconfig_em0="inet IP.FAIL.OVER netmask 255.255.255.255 broadcast IP.FAIL.OVER"
  • static_routes="net1 net2"
  • route_net1="-net GATEWAY_VM/32 IP.FAIL.OVER"
  • route_net2="default GATEWAY_VM"

File : /etc/resolv.conf

 

  • nameserver 213.186.33.99 # DNS Server

Windows 2003
First, open the “Network Connections” panel (Start -> Control Panel -> Network Connections -> Local Area Connections)

Then, select Properties :


Local Area Connections

Then, select Internet Protocol (TCP/IP):


Local Area Connections

Finally, you will need your ip Failover in the field “IP Address”, the subnet mask 255.255.0.0, the gateway to your physical machine as default gateway and ip 213.186.33.99 as the preferred DNS server.


Internet Protocol (TCP/IP)

For the second step, via the Start menu, click Run, then type regedit. Once in the application, you should find your ip-failover (Edit -> Search). Once the IP found, double-click the parameter SubnetMask? “and change 255.255.0.0 to 255.255.255.255, then you validate.

Close the registry editor

Finally, to validate the changes, you must restart the network interface (Start -> Control Panel -> Network Connections -> Connection LAN -> right click, then Disable)

Wait a few seconds and re-enable the network connection

Windows Server 2012 / Hyper-V
First you need to create Virtual Switch.

On the command line of the host server run IPconfig /ALL
Note the name of the network adapter that contains the IP address of the server’s assigned IP.
In Hyper-V manager create the a new virtual switch.
Connection Type is External
Select the adapter with the server’s IP
Check Allow management OS to share this network adapter

Virtual Switch Manager

Note

This step only is required once for a hyper-v server. For all VMs, a virtual switch is required to connect the VM’s virtual network adapters to the server’s physical adapter.

Then select the VM that you wish to add the Failover IP. Use the Hyper-V Manager to change the settings of the VM (it needs to be shutdown).

Expand the Network Adapter and click on Advanced Features.
Change the MAC address to Static and enter the Virtual MAC address for Failover IP.
Press OK to apply changes.

Hyper-V Manager

Start the VM and log in as an administrator.

Control Panel > Network and Share Center
Click on the Connections: Ethernet link
Click on Properties Button to show Ethernet Properties
Select Internet Protocol Version 4 (TCP/IPv4)
Click on Properties Button to show IP V4 Properties

Ethernet Properties

On the IPv4 Properties window:

Select the Use the following IP address
Enter the Failover IP into the IP Address
Enter 255.255.255.255 into the Subnet Mask
Enter your server’s gateway IP address into the Default Gateway (your server’s IP ending with 254)
Enter 213.186.33.99 into the Preferred DNS Server.
Press OK and ignore the warning message about the gateway IP and Assigned IP not being in the same subnet.

Ethernet Properties

Finally, reboot server and the VM should be connected to the internet using the failover IP.

Other distributions
Here is the network configuration required in the Virtual Machine:

ip: IP_FAIL_OVER
netmask: 255.255.255.255
It is also required to add a default gateway to the Virtual Machine:

route add GATEWAY_VM dev eth0
route add default gw GATEWAY_VM
You will then need to configure the DNS of your machine so that it can make domain resolution. The IP of the DNS server is 213.186.33.99.

Adding a virtual MAC
Configuring an IP in bridging will require you to configure a virtual MAC address for your IP address. In order to do that, go in your Control Panel. Click on the IP section on the left. In the IP section, click on the gear next to your IP. Then, select Add a virtual MAC.

Click on the gear then choose "Add a virtual MAC"
Adding a vMAC - Step #1

In the menu that appears, select the type of virtual MAC. If you install any version of VMWare ESXi, choose “vmware”. In any other case, choose “fog”. Put a name for your virtual machine. It doesn’t have to be the same name as in your hypervisor. It can be any name.

Select "vmware" for ESXi or "fog" for anything else
Adding a vMAC - Step #2

Once you’re done, click on Confirm. The creation of the vMAC will take a couple of minutes. Once it is completed, the vMAC will appear under “Virtual MAC”. You may have to refresh your browser to see the change.

The vMAC will appear in the IP section under "Virtual MAC"
Adding a vMAC - Step #3

Warning

It is not necessary nor it is possible to assign a vMAC to an IP that is inside a vRack.


Was this article helpful?

mood_bad Dislike 4800
mood Like 427
visibility Views: 58183