2

I have Debian Jessie server, and I have install apache server. From apache hosted several sites from different ip address. My server have resources for KVM. My question is - How I can set my free IP to guest KVM machine.. My free IP is eth0:3 -> 80.80.130.135 My configuration /etc/network/interfaces file is:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

auto eth0
auto eth0:0
auto eth0:1
auto eth0:2
auto eth0:3

allow-hotplug eth0
iface eth0 inet static
    address 80.80.130.131
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain

iface eth0:0 inet static
    address 80.80.130.132
    netmask 255.255.255.192
    network 80.80.130.128
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:1 inet static
    address 80.80.130.133
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:2 inet static
    address 80.80.130.134
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:3 inet static
    address 80.80.130.135
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain
1
  • 1
    I advise you not to post any public addresses that belong to you. Nov 24, 2015 at 10:13

1 Answer 1

2
  1. Modify /etc/network/interfaces on your jessie host so that it uses a bridged interface for eth0.

e.g. delete your eth0 and eth0:* aliases definitions and add the following:

auto br0
iface br0 inet static
    address 80.80.130.131
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    post-up ip addr add 80.80.130.132 dev br0
    post-up ip addr add 80.80.130.133 dev br0
    post-up ip addr add 80.80.130.134 dev br0
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 1
    bridge_fd 1
    bridge_hello 2
    bridge_maxage 12

After rebooting or ifdown -a ; ifup -a you can configure your guest:

  1. Configure the guest to use br0. You can do this with a GUI using virt-manager, or you can edit the XML file directly with virsh edit domainname, and change the interface definition to something like this:
<interface type='bridge'>
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
  1. Now you can either configure the guest to use the static IP 80.80.130.135 in /etc/network/interfaces (or whatever is appropriate for your VM if it's not another Debian system), or you can configure dnsmasq to allocate that IP to the VM's MAC address.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .