I have a virtualization server with one IP and 5 VM. To get internet access and ssh access in every VM I do this in
-------------/etc/network/interfaces-------
auto vmbr2 iface vmbr2 inet static address 192.168.0.254 netmask 255.255.255.0 bridge_ports none bridge_stp off bridge_fd 0 post-up echo 1 > /proc/sys/net/ipv4/ip_forward post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 192.168.0.1:22 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 192.168.0.1:22
This is ok. Now I need set a different external proxy to every VM. For example: VM 192.168.0.1 used this proxy user:pass@11.12.13.14:3218
to access the internet.
How can I do it? Is it possible using only iptables?