Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Question about proxmox openvz containers and port forwarding
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Question about proxmox openvz containers and port forwarding

FluXFluX Member

So I've grabbed the online.net nano dedi and decided I'd use it to play around with VM's.

I've already set up the port forwarding via iptables on the main box, but was wondering how it tied into the creation of each container.

this is the contents of my /etc/network/interfaces file

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto vmbr0
iface vmbr0 inet static
        address MYSERVERIP
        netmask 255.255.255.0
        network MYSERVERIP.0
        broadcast MYSERVERIP.255
        gateway MYSERVERIP.1
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

#First vm test interface
auto vmbr0:0
iface vmbr0:0 inet static
        address 192.168.5.1
        netmask 255.255.255.0
        network 192.168.5.0
        broadcast 192.168.5.255

post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.5.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.5.0/24' -o vmrb0 -j MASQUERADE

When creating the openvz container what do I choose under the network tab?
Do I choose Routed mode (venet) and specify a local ip such as 192.168.5.100?
or do I choose Bridge mode? (I don't actually see the vmbr0:0 interface as active under the main node so I can't select it.

Any clarification would be appreciated!

Comments

  • jarjar Patron Provider, Top Host, Veteran

    If I'm not misunderstanding anything you did there, I'd do venet and assign an ip of your choice. Configuring veth has never been fun to me.

  • I seem to still be having trouble. I've assigned the openvz container to the 192.168.5.10 ip under venet in proxmox. But when I try to ssh to my server's ip @ port 8888 the ssh doesn't go through Putty just hangs. I'm thinking the server is just refusing the connection. Any help ?

    Under iptables there is an entry for the portforwarding of ssh.

    Chain PREROUTING (policy ACCEPT 7 packets, 364 bytes) 
    pkts bytes target     prot opt in     out     source               destination
    0     0     DNAT     tcp  --  vmbr0  *       0.0.0.0/0            0.0.0.0/0           tcp dpt:8888 to:192.168.5.10:22
    
  • 5n1p5n1p Member
    edited November 2013

    Try this:

    iptables -t nat -A POSTROUTING -s 192.168.5.0/24 -o vmbr0 -j SNAT --to your_public_IP

Sign In or Register to comment.