We have a couple of virtual servers hosted with Softlayer for processing data and backup purpose. The public interface is completely turned off i.e. no Internet access. We can only access VMs using a VPN. It resulted in decreased costs and many security problems for backend servers. However, when you order “Private Network Only” cloud VM, you cannot route outgoing traffic to the Internet using your VM.
This is how we order the server for our company:
Fig.01: Private only network at Softlayer cloud. No direct outgoing or incoming access from the Internet
You can’t access the Internet or download or upload files to the internet:
Fig.02: Look ma no internets
Use proxy server
I did setup a squid 3 proxy server one of our public VM. This VM can access both private cloud and public internet on the same VLAN. Sample squid3.conf:
acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager ## private vm ## acl zfsbackup src 10.81.33.4 http_access allow zfsbackup http_access allow localhost http_access deny all ## this server with eth0 connected to VLAN ## http_port 10.86.115.100:3128 cache_dir ufs /var/spool/squid 100 16 256 coredump_dir /var/spool/squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|?) 0 0% 0 refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 refresh_pattern . 0 20% 4320 ## this server with eth1 connected to the Internt ## tcp_outgoing_address 75.zzz.xxx.yyy forwarded_for delete via off forwarded_for off follow_x_forwarded_for deny all request_header_access X-Forwarded-For deny all cache_mem 1024 MB
Now, all you have to do is setup http_proxy variables on private VM to download files from the internet or git repos:
# set http_proxy, do not forget to set ftp_proxy, https_proxy, socks_proxy etc export http_proxy="http://10.86.115.100:3128" export HTTP_PROXY="http://10.86.115.100:3128" # Now we have access to the internet ## wget http://some-url/file.foo.gz curl -I google.com lynx google.com # special case git config --global http.proxy $http_proxy git commands here # Use proxy sever with user and password export http_proxy=http://USERNAME:PASSOWRD@10.86.115.100:3128" wget .. curl ..
Make sure you read man pages of commands that need http_proxy access. Don’t forget to add http_proxy in your shell startup file i.e. ~/.bash_profile.