Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
routing eth0:1 directly to kvm VM
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pid
n00b
n00b


Joined: 22 Sep 2003
Posts: 15

PostPosted: Sun Oct 21, 2012 3:23 pm    Post subject: routing eth0:1 directly to kvm VM Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21490

PostPosted: Sun Oct 21, 2012 4:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
pid
n00b
n00b


Joined: 22 Sep 2003
Posts: 15

PostPosted: Sun Oct 21, 2012 4:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
AngelKnight
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2003
Posts: 127

PostPosted: Fri Nov 16, 2012 5:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum