Hi
It's since a while that I'm fiddling around with the network setup of my server and am not sure which solution would be the best & simpliest one.
Situation:
- Root server, with 1 public IPv4 address and a lot of public IPv6 addresses available.
- Running on the server 2 VMs.
- VM1 runs the Apache webserver
- VM2 runs the mailserver
Final target:
Would like to have both external IPv4 and IPv6-requests ending up into the right VM.
What I did so far:
1)
This was simple: I used KVM's port-forwarding functionality to forward all incoming requests on a specific port (e.g. port 80 for http) to the correct VM (e.g. VM1 for http/port 80 requests).
Example:
Code:
KVM_CMD="qemu-kvm \
-nographic -daemonize \
-balloon none \
-pidfile $PIDPATH \
-drive file=/mnt/vm/images/amd64-gentoo-main/rootfs.img,if=virtio,cache=writeback \
-drive file=/mnt/vm/images/amd64-gentoo-main/swapfile.img,if=virtio,cache=writeback \
-m 3072 -smp 3 \
-kernel /boot/current-kernel \
-append \"root=/dev/vda\" \
-net nic,model=virtio,macaddr=DE:AD:BE:EF:29:10 \
-net user,host=192.168.1.2,restrict=n,net=192.168.1.0/24,\
hostfwd=tcp::80-:80"
Unluckily this mechanism does not handle IPv6
2)
I am now thinking about a network bridge (br0 and tap1/2/3...). I could create one (tried yesterday and it worked - had a tap-devices available to be used) and using that I could set in every single VM one of the many external IPv6-addresses, but because I don't have more than 1 external IPv4-addresses I think that I'll have to set up iptables on the host to forward incoming IPv4-requests to the correct VM depending on the port.
I'm not sure if option 2 is actually valid - it's good that I can decide from within the VM which external IPv6-address I want to use (or at least I think so), but IPv4 won't work because I don't have any additional IPv4-address (the only one I have is used by the host itself) => I might have to create a virtual NIC on the host that points to an internal network (e.g. 10.0.0.1) and give to the VMs that kind of address (e.g. 10.0.0.10 to VM1 and 10.0.0.20 to VM2).
Not sure if what I write is makes sense...
[EDIT-START]
And if I use option 2 and create a bridge on an internal virtual network, probably the IPv6 from within the VMs won't be able to reach the outer network/Internet?
Getting very confused... .
[EDIT-END]
All this sounds quite complicated... .
Am I making things too complicated? Any simplier solution for this kind of setup?
Thanks a lot.