Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
added 29 characters in body
Source Link
erama
  • 43
  • 1
  • 1
  • 4

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:

-------------/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 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:[email protected]:3218 to access the internet.

How can I do it? Is it possible using only iptables?

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:[email protected]:3218 to access the internet.

How can I do it? Is it possible using only iptables?

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:[email protected]:3218 to access the internet.

How can I do it? Is it possible using only iptables?

formatting
Source Link
Falcon Momot
  • 25.6k
  • 15
  • 66
  • 92

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:

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:[email protected]:3218 to access the internet.

How can I do it,? Is it is possible using only iptables?

I have a virtualization server with one IP and 5 VM. To get internet access and ssh access in every VM I do this:

------------ /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:[email protected]:3218 to access the internet.

How can I do it, it is possible using only iptables?

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:[email protected]:3218 to access the internet.

How can I do it? Is it possible using only iptables?

I have a virtualization server with one IP and 5 VM. To get internet access and ssh access in every VM I do this:

------------/etc/network/interfaces /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 MASQUERADEauto 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:22post-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:[email protected]:3218user:[email protected]:3218 to access the internet.

How can I do it, it is possible using only iptables?

I have a virtualization server with one IP and 5 VM. To get internet access and ssh access in every VM I do this:

------------/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:[email protected]:3218 to access the internet.

How can I do it, it is possible using only iptables?

I have a virtualization server with one IP and 5 VM. To get internet access and ssh access in every VM I do this:

------------ /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:[email protected]:3218 to access the internet.

How can I do it, it is possible using only iptables?

Source Link
erama
  • 43
  • 1
  • 1
  • 4
Loading