I saw mentions of Alpine Linux growing lately, especially within the Docker community. Instead of using Ubuntu as the base OS for Docker containers, Alpine is becoming more and more popular lately. I was thinking to run a test-drive on Alpine and I did.
First, let’s download Alpine. I chose the virtual variant because I planned to use it on VirtualBox. At first I set the connection to use bridged network because I wanted to use
avahi (proper configuration was done later). The installation was straightforward as outlined on the wiki.
The on-screen instruction should be self-explanatory for most parts. Then, I installed packages that I considered as crucial for a minimal working box.
setup-apkcache apk add vim curl nano htop dbus avahi htop git sudo ufw ip6tables mc zsh
ufw requires testing repo enabled in
ufw and add it to the startup, then set it to allow for
ufw enable rc-update add ufw sudo ufw allow ssh
I prefer using
zsh as my shell interface. For a more interesting
zsh session, I installed
git. To clean the package cache, run
apk -v cache clean. After that, start
avahi and add it to startup.
rc-service avahi-daemon start rc-update add avahi-daemon
It is a good idea to create a new user instead of using
root (use the
adduser command). Edit the
visudo to allow our new
$USER to use the
This is the interesting part. At first, the network was set to use the bridged adapter. With regard to security, bridged adapter is less secure than NAT. However, with NAT I cannot get
avahi to work. So how do we do this? The solution is to use both NAT and a secondary host-only adapter.
On the VirtualBox preference itself, go to Network and then the Host-only Networks to configure
vboxnet0. I set the adapter with the following values:
IPv4 Address: 192.168.56.1 IPv4 Network Mask: 255.255.255.0
The DHCP Server is disabled for this
vboxnet0. The instance (Alpine linux) will ask for a static IP for the host-only network. We are done here. Close the VirtualBox preference and let’s configure the network for the Alpine instance. Right-click on the Alpine instance and click Settings…, go to Network and make sure Adapter 1 and Adapter 2 are enabled. Set Adapter 1 to NAT and Adapter 2 to Host-only Adapter via
vboxnet0. For the Advanced configuration in Adapter 2, set the Promiscuous Mode to
Now, let’s configure the Alpine linux itself to use both adapters. Now, edit the file
/etc/network/interfaces. Here is my configuration:
auto lo iface lo inet loopback # NAT on Adapter 1 auto eth0 iface eth0 inet dhcp # Host-only on Adapter 2 auto eth1 iface eth1 inet static address 192.168.56.10 netmask 255.255.255.0
Reboot is required.