PROXMOX , ACCESS VM FROM IP PUBLIC USING IPTABLE (NAT)


BEFORE

root@proxmox1:/etc/network# cat interfaces

# network interface settings
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address  192.168.137.104
netmask  255.255.255.0

iface eth1 inet manual

auto eth2
iface eth2 inet static
address  192.168.0.251
netmask  255.255.255.0

auto vmbr0
iface vmbr0 inet static
address  192.168.0.250
netmask  255.255.255.0
gateway  192.168.0.254
bridge_ports eth1
bridge_stp off

        bridge_fd 0
AFTER
root@proxmox1:/etc/network# cat interfaces

# network interface settings
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.137.104
netmask 255.255.255.0

iface eth1 inet manual

auto eth2
iface eth2 inet static
address 192.168.0.251
netmask 255.255.255.0

auto vmbr0
iface vmbr0 inet static
address 192.168.0.250
netmask 255.255.255.0
gateway 192.168.0.254
bridge_ports eth1
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp  (Perhatikan baris ini yah!!)

auto vmbr1
iface vmbr1 inet static
address 192.168.37.1
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.37.0/24’ -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s ‘192.168.37.0/24’ -o vmbr0 -j MASQUERADE

Restart Network

root@proxmox1:/etc/network# /etc/init.d/networking restart

Run on HOST

iptables -t nat -A PREROUTING -i vmbr0 -p tcp –dport 2222 -j DNAT –to 192.168.37.2:22

iptables -t nat -A PREROUTING -i vmbr0 -p tcp –dport 8888 -j DNAT –to 192.168.37.2:80

 

VM :
ifconfig eth0 192.168.37.2 netmask 255.255.255.0

route add default gw 192.168.37.1

Thanks

 

 

 

Advertisements

One thought on “PROXMOX , ACCESS VM FROM IP PUBLIC USING IPTABLE (NAT)

  1. santiro March 31, 2014 at 6:34 pm Reply

    auto eth0
    iface eth0 inet static
    address 192.168.137.104
    netmask 255.255.255.0

    permisi.. apkah ini ip public mas… konfigurasi ni 100% jalan ngk mas..? gimana caranya klo internet yng dipakai dhcp mas..? sy kesulitannya dstu pada saat membuat OpenVZ Supaya bisa akses ke public.. minta bantuannya mas

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: