Tuesday, October 16, 2012

sshuttle and juju for seamless private network bridging

Suppose you're getting started with juju, but you wish to try this on a VM or separate server dedicated to the task, further suppose you wish to use LXC for development purposes. Once everything is said and done you'll have a working juju service with an ip address you can't reach.
ppetraki@mark21:~/Sandbox/juju-local$ juju status
machines:
  0:
    agent-state: running
    dns-name: localhost
    instance-id: local
    instance-state: running
services:
  mysql:
    charm: cs:precise/mysql-8
    relations:
      db:
      - wordpress
    units:
      mysql/0:
        agent-state: started
        machine: 0
        public-address: 192.168.122.119
  wordpress:
    charm: cs:precise/wordpress-9
    exposed: true
    relations:
      db:
      - mysql
      loadbalancer:
      - wordpress
    units:
      wordpress/0:
        agent-state: started
        machine: 0
        open-ports:
        - 80/tcp
        public-address: 192.168.122.196
The solution? sshuttle.
$ sshuttle -r mark21 192.168.122.0/24
Will use iptables to create a NAT which tunnels over ssh to bridge this network. Now you can visit 192.168.122.196 in your web browser and have full TCP access to that network, all without using openvpn.

No comments:

Post a Comment