0

I have a dedicated server in Hetzner. In which I have installed CentOS 7.4, inside it I have KVM with another CentOS 7.4.

I have requested an additional ip from Hetzner that has a Mac separated for virtualization purposes.

I would like the guest to have access to the internet and that this virtual machine can be accessed from the internet.

Here's the data from the two ips I have with Hetzner robot.

Main IP: AA.BBB.CCC.DD

Gateway:       AA.BBB.CCC.1
Netmask:       255.255.255.192
Broadcast:     AA.BBB.CCC.63

Additional IP: AA.BBB.CCC.EE

Gateway:       AA.BBB.CCC.1
Netmask:       255.255.255.192
Broadcast:     AA.BBB.CCC.63

This is the file /etc/sysctl.d/99-hetzner.conf configuration

### Hetzner Online GmbH installimage
# sysctl config
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.icmp_echo_ignore_broadcasts=1
# ipv6 settings (no autoconfiguration)
net.ipv6.conf.default.autoconf=0
net.ipv6.conf.default.accept_dad=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.default.accept_ra_defrtr=0
net.ipv6.conf.default.accept_ra_rtr_pref=0
net.ipv6.conf.default.accept_ra_pinfo=0
net.ipv6.conf.default.accept_source_route=0
net.ipv6.conf.default.accept_redirects=0
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.all.accept_dad=0
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.all.accept_ra_defrtr=0
net.ipv6.conf.all.accept_ra_rtr_pref=0
net.ipv6.conf.all.accept_ra_pinfo=0
net.ipv6.conf.all.accept_source_route=0
net.ipv6.conf.all.accept_redirects=0

This is the initial configuration just installed and running host

DEVICE=enp0s31f6
ONBOOT=yes
BOOTPROTO=none
IPADDR=AA.BBB.CCC.DD
NETMASK=255.255.255.255
SCOPE="peer AA.BBB.CCC.1"
IPV6INIT=yes
IPV6ADDR=2a01:4f8:13b:1801::2/64
IPV6_DEFAULTGW=fe80::1
IPV6_DEFAULTDEV=enp0s31f6

This is the previous file modified to get a bridge

DEVICE=enp0s31f6
ONBOOT=yes
HWADDR=90:1b:0e:ee:05:4e
BOOTPROTO=none
IPADDR=AA.BBB.CCC.DD
NETMASK=255.255.255.192
SCOPE="peer AA.BBB.CCC.1"
BRIDGE=br0

This is the br0 file I created

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
IPADDR=AA.BBB.CCC.DD
NETMASK=255.255.255.192
SCOPE="peer AA.BBB.CCC.1"
ONBOOT=yes
DELAY=0

Does anyone know what configuration should be done in CentOS guest?

Is there something wrong with what I've done published above?

Thank you so much for the help.

2 Answers 2

0

First, you need to create the guest's virtual network interface using the virtual MAC address that Hetzner assigned to you, and bridged to br0 on your host system. For example (libvirt XML):

    <interface type='bridge'>
      <mac address='00:0c:29:34:b3:a1'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>

You then configure the guest OS with the associated IP address, netmask and gateway. The IP address is not assigned to the host.

5
  • Hi Michael, thank you for your answer. I've gone to the location /etc/libvirt/qemu/networks/ With the command "virsh net-list --all" I have verified that the only connection is called "default". This is the file where I will have to modify its contents? Thanks
    – xav
    Jan 17, 2018 at 8:49
  • @xav No, you specify the bridge in the virtual machine configuration. You do not need to add or edit another virtual network. Jan 17, 2018 at 8:51
  • This is the default setting for virtual networks: link and when I create the virtual machine I select this network:link Finally, in the guest configuration, I have removed the existing nic to create a new nic in which I have assigned the mac that Hetzner gave me for the additional ip. link if it's not too much trouble, could you tell me if what I've done is right?
    – xav
    Jan 17, 2018 at 9:10
  • Yes, that all looks correct. That's exactly the way I specified, too. Jan 17, 2018 at 9:11
  • Everything seems to be working fine. Thank you very much for all your help!
    – xav
    Jan 17, 2018 at 10:06
-1

Please provide additional information, what is your virtualization platform? Is there any console to access the host machine? Like vmware (vsphere client), proxmox (web based), openstack (web based).

I think you need to check the interface bridge on that machine and ensure that the virtual network interface (usually tap interface) are listed as bridge member along with your host network interface (enp0s31f6).

Please use the following command to find if the network are correct and post the results.

# ifconfig -a
# brctl show

Thank you

You must log in to answer this question.

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