View previous topic :: View next topic |
Author |
Message |
pid n00b
Joined: 22 Sep 2003 Posts: 15
|
Posted: Sun Oct 21, 2012 3:23 pm Post subject: routing eth0:1 directly to kvm VM |
|
|
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 |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21639
|
Posted: Sun Oct 21, 2012 4:27 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
pid n00b
Joined: 22 Sep 2003 Posts: 15
|
Posted: Sun Oct 21, 2012 4:53 pm Post subject: |
|
|
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! |
|
Back to top |
|
|
AngelKnight Tux's lil' helper
Joined: 14 Jan 2003 Posts: 127
|
Posted: Fri Nov 16, 2012 5:33 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|