Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my config:

  • my proxmox host is set on public_ip
  • my vm1 contains a gitlab up and running with source code for project1
  • my vm2 contains a test version of project1

I rerouted all traffic to public_ip port 2222 to vm1 port 22 => I can therefore pull the code from gitlab from any machine OUTSIDE of my private network (meaning, outside of the proxmox network).

I'm trying to git pull project1 from vm2 through the public IP. Here is my command to test it:

# ssh -vvv git_mydomain_com -p 2222
OpenSSH_6.7p1 Ubuntu-5ubuntu1.3, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to git_mydomain_com [*public_ip*] port 2222.
debug1: connect to address *public_ip* port 2222: Connection refused
ssh: connect to host git_mydomain_com port 2222: Connection refused

I try the same command but using the internal IP for vm1:

# ssh -vvv *internal_192_ip* -p 22
OpenSSH_6.7p1 Ubuntu-5ubuntu1.3, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to *internal_192_ip* [*internal_192_ip*] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
[...]
root@*internal_192_ip*'s password:

Question: how can I reach vm1 from vm2 using the git_mydomain_com:2222 approach?

UPDATE 1: @EliDevendre:

# netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      0          2763713     605/master      
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      102        2762443     256/systemd-resolve
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          37133401    4770/nginx.conf 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          2762427     255/sshd        
tcp6       0      0 :::25                   :::*                    LISTEN      0          2763714     605/master      
tcp6       0      0 :::3306                 :::*                    LISTEN      111        33585179    2558/mysqld     
tcp6       0      0 :::22                   :::*                    LISTEN      0          2762430     255/sshd        
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           102        2762442     256/systemd-resolve
share|improve this question
    
Few questions: 1) How did you rerouted all traffic. 2) Are you able to connect the vm2 server over internal IP? 3) Is there something in server logs about rejection? – Jakuje Dec 6 '15 at 9:57
    
Haven't you got IPv6? – Michael Hampton Dec 6 '15 at 10:59
    
1) I added acces to the Internet to all VMs: iptables -t nat -A POSTROUTING -o eth1 -s 192.168.15.20/23 -j MASQUERADE iptables -t nat -A POSTROUTING -o vmbr0 -s 192.168.15.20/23 ! -d 192.168.15.20/23 -j SNAT --to-source public_ip Then I rerouted all incoming traffic from port 2222 to the VM hosting gitlab iptables -t nat -A PREROUTING -p tcp -d public_ip --dport 2222 -i vmbr0 -j DNAT --to-destination 192.168.15.1:22 – KidTwist Dec 6 '15 at 16:18
    
2) yes, if, from VM2, I type ssh 192.168.15.2 -p 22 , I am able to connect to it – KidTwist Dec 6 '15 at 16:21
    
3) I ve checked the host logs (auth.log + iptstat), nothing shows. Not sure what to check on VM1 – KidTwist Dec 6 '15 at 16:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.