From: Stefan Hajnoczi Subject: Re: Redirections from virtual interfaces. Date: Mon, 3 Jun 2013 11:35:29 +0200 Message-ID: <20130603093529.GE16498@stefanha-thinkpad.redhat.com> References: <51A8AF50.2040806@targinosilveira.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Targino SIlveira Return-path: Received: from mail-bk0-f43.google.com ([209.85.214.43]:44785 "EHLO mail-bk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604Ab3FCJfd (ORCPT ); Mon, 3 Jun 2013 05:35:33 -0400 Received: by mail-bk0-f43.google.com with SMTP id jm19so734107bkc.16 for ; Mon, 03 Jun 2013 02:35:32 -0700 (PDT) Content-Disposition: inline In-Reply-To: <51A8AF50.2040806@targinosilveira.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, May 31, 2013 at 11:10:24AM -0300, Targino SIlveira wrote: > I have an server with only one NIC, this NIC has a Public IP, this > server is locate in a data center, I can't have more than one, but I > can have many IP's, so I would like to know if I can redirect > packages from virtual interface for my VM's? > > Examples: > > eth0:1 xxx.xx.xxx.xxx redirec all trafic to 192.168.122.200 > eth0:2 xxx.xx.xxx.xxy redirec all trafic to 192.168.122.150 > eth0:3 xxx.xx.xxx.xxz redirec all trafic to 192.168.122.180 > > I'm using /etc/libvirt/hooks/qemu to write iptables rules. Yes, look at NAT. A lot of material probably covers NAT behind one public IP, in this case you actually need to map public addresses onto private addresses 1:1. A web search for "linux nat" should turn up howtos. Or check on libvirt.org if there is libvirt configuration that automatically sets this up for you. Stefan