Friday, January 18, 2013

Access to web application on *BSD on VirtualBox from HostOS

If you want to access web application on *BSD on VirtualBox from host-OS:

  1. In VirtualBox settings, enable "Host Only Adapter"
  2. Install *BSD as guest-OS, and specify IP address with typing ifconfig em1
  3. launch web application with larger port number, because *BSD has its firewall PF, and /etc/pf.conf allows that larger port number passes "any to any" as default.
pass in quick on em1 proto {tcp,udp} from any to any port 49152:65535 keep state

For example, in guest-OS:
$ ifconfig em1
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
  ether 08:00:27:e0:cd:cc
  inet6 fe80::a00:27ff:fee0:cdcc%em1 prefixlen 64 scopeid 0x3 
  inet netmask 0xffffff00 broadcast
  media: Ethernet autoselect (1000baseT <full-duplex>)
  status: active
$ rails s -p 59049
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-01-18 20:24:36] INFO  WEBrick 1.3.1
[2013-01-18 20:24:36] INFO  ruby 1.9.3 (2012-11-10) [amd64-freebsd9]
[2013-01-18 20:24:36] INFO  WEBrick::HTTPServer#start: pid=53329 port=59049

For example, in host-OS:

No comments:

Post a Comment