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
  options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
  ether 08:00:27:e0:cd:cc
  inet6 fe80::a00:27ff:fee0:cdcc%em1 prefixlen 64 scopeid 0x3 
  inet 192.168.56.101 netmask 0xffffff00 broadcast 192.168.56.255
  nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
  media: Ethernet autoselect (1000baseT <full-duplex>)
  status: active
$ rails s -p 59049
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://0.0.0.0:59049
=> 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