Alpine Single Node

1 Overview

+------- Host ---------+
| +----- Container -+  |
| |   +- VM ---+    |  |
| |   |        |    |  |
| |   +--------+    |  |
| +-----------------+  |
+----------------------+

Container               VM
192.0.0.2            192.0.0.10
   br0                  eth1
    +                    +
    +--------------------+

2 Setup

2.1 Create Container

host$ git clone https://github.com/thachmpham/lab.git
host$ cd lab/alpine/use/single-node
host$ docker compose build
host$ docker compose up --detach
host$ docker exec -it apk bash

2.2 Create VM

container$ ./create_vm.sh
vm$ setup-alpine
# - hostname:   vm
# - interface:  eth0
# - ipv4 addr:  dhcp
# - ipv6 addr:  auto
# - manual network config:  no
# - password:
# - timezone:   UTC
# - proxy:      none
# - ntp:        busybox
# - apk mirror: 1
# - setup user: no
# - ssh server: openssh
# - allow root ssh: yes
# - ssh key:    none
# - disk:       sda, sys

vm$ poweroff
container$ ./start_vm.sh

2.3 Static IP

vm$ cat /etc/network/interfaces
# -------------------- #
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
hostname alpine-test

auto eth1
iface eth1 inet static
    address 192.0.0.10
    netmask 255.255.255.0
# -------------------- #
vm$ rc-service networking restart

vm$ ip addr show
eth1: inet 192.0.0.10

2.4 Allow SSH

vm$ vi /etc/ssh/sshd_config
# -------------------- #
PermitRootLogin yes
# -------------------- #
vm$ rc-service sshd restart
container$ ssh root@192.0.0.10

3 Shortcuts

QEMU keys:

4 References