Multiple IPs + Bridge for KVM

Right now I have a problem and I really don't know where the error is. I received a Root-Server from my ISP. One IP address is already enabled on this root server, and today I registered two more IP addresses. So now I want to map these two new IP addresses on two virtual machines, and also enable the included IP address for Root-Server. So how do I understand that?

I thought something like:

br0 - contains the source IP address of the root server

br0:0 - contains the first IP address of the first virtual machine

br0:1 - contains the second IP of the second virtual machine

But that does not work. Any ideas. I'm so sad. Worked on a hole. Day on it and without a solution.

+3
source share
2 answers

, , , , , , , iptables..

#create alias for your second ip address (lets say its 111.222.333.2 , local address 192.168.1.2)
ifconfig eth0:1 111.222.333.2 
#you should add netmask to be proper if you've got subnet 

#now you should be able to ping this second address from outside world - try it,
#that is if you have not set up firewall to block pings ... flush iptables rules if you are not sure...

#set up NAT rule (network-address-translate : outside ip-> local ip and back local ip->outside ip)
#assumes your virtual machines lives as 192.168.1.2
iptables -t nat -A PREROUTING -d 111.222.333.2 -j DNAT --to-destination 192.168.1.2
iptables -t nat -A POSTROUTING -s 192.168.1.2 -j SNAT --to-source 111.222.333.2

IP- KVM, (forward mode = nat), NAT IP, IP- . --, iptables -d 111.222.333.2:80 -p tcp, ...

IP- , , ,

sysctl -a | grep forward
( eth0), sysctl,
sysctl -w net.ipv4.ip_forward=1
+4

br0 VM1 VM2 TAP DEVICE, VM1 VM2 ; IP1 IP2 VM1 VM2; ping VM1 VM2 - (VM1 VM2);

TAP VM ; . qemu-ifup script .

0

All Articles