# routing eth0:1 directly to kvm VM

## pid

Ive got a Dedicated Server with 2 Public IP Adresses and would like to route all eth0:1 traffic to a KVM Guest via iproute2 or even iptables. Outgoing Traffic should also be routed to eth0:1 - eth0 and eth0:1 are assigned in different Subnets.

Setup is/should be as following:

178.1.2.3 eth0:1 <-> 192.168.1.254 br1, gateway for tap1 <-> 192.168.1.1 KVM Guest

----------

## Hu

Assuming you are using the typical notation, the presence of eth0:1 says you are using the legacy way of adding multiple IP addresses to a single interface.  The tools from iproute2 can put multiple addresses on a single interface without creating alias interfaces.  However, for what you want, it looks like it would be sufficient to have eth0 be configured without an address, br1 configured with public IP #1, and KVM guest configured with public IP #2.  Then, join eth0 and the host-side KVM interface into br1.

----------

## pid

it actually was surprisingly simple:

    -A PREROUTING -d 178.1.2.3/32 -j DNAT --to-destination 192.168.1.1

    -A POSTROUTING -s 192.168.1.1/32 -j SNAT --to-source 178.1.2.3

thanks anyway!

----------

## AngelKnight

If you can reconfigure the dedicated server to use a bridge for the interface bearing, assign the 1st public IP to the bridge, then attach a TAP (*not* TUN) from the kvm onto the bridge, you could just configure the 2nd IP directly on the guest VM.

----------

