Q:

How can I get the networking to work offline for a Debian VirtualBox VM in Mac OS X? 

So I am running a Debian VirtualBox VM in Mac OS X. If I am connected to internet through wifi or ethernet everything works just fine in the Bridged Adapter mode.  But how can I get it to work offline too? 

A:

Add a host-only network on the host (Preferences > Network).  You can choose the ip address range used by this network and you can also activate a DHCP server. 
Then, in the VM configuration you need to add a card, choose “Host-only networking” and select the network you just created. 
Boot the VM and it will have a new interface.  You need to configure that interface either with a static IP or by using DCHP if you started the server on the host. 
More documentation : Host-only networking

