saschpe / libvirt-hook-qemu

Libvirt hook for setting up iptables port-forwarding rules when using NAT-ed networking.
236 stars 69 forks source link

Cannot find qemu.json. #23

Open navhos opened 7 years ago

navhos commented 7 years ago

The qemu.json file cannot be found in /etc/libvirt/hooks/. However, hooks.json is located there. These are the contents of hooks.json:

{
    "cloud-admin": {
        "interface": "virbr1",            // you can use comments
        "private_ip": "192.168.124.10",   /* both styles */
        "source_ip": "8.8.8.8",
        "port_map": {
            "tcp": [[1100, 3000], 443]
        }
    },
    "cloud-node1": {
        "private_ip": "192.168.126.2",
        "port_map": {
            "tcp": [[1101, 80],
                    [1102, 443]]
        }
    }
}

Could anyone advise on how I can edit this file to suit my network configuration settings? I am using an ethernet connection on the host machine(Ubuntu 16.04LTS), and a NAT configuration on Cent OS 7 VMs.

oscziryak commented 6 years ago

The name has to be the name of the VM as known to libvirt. The private IP has to be the one known to the host. And for the host map, the first number is the port on the host. The second number is the port on the VM.

claes commented 6 years ago

The documentation could be clearer about the filename. I suspect that qemu.json is a reference to what it was called previously and the documentation is not updated? Or vice versa? In any case, the installation does not create the qemu.json file so either the user is expected to create it themselves, or they should edit hooks.json. But from what I can tell, hooks.json is the file that is read