This repo includes ansible playbooks to setup rpi4 for measuring ping/pong.
host
is executing ansible-playbook machine.target
is rpi4.
- Install Raspberry Pi Imager
https://www.raspberrypi.com/software/
- Install ansible to host.
apt install ansible sshpass
-
start Raspberry Pi Imager
-
select rpi4
-
select
Ubuntu Server 22.04 LTS(64-bit)
- select Storage, be carefull
- click "次へ" and OS Customization
- ユーザー名とパスワード設定(ユーザー名は ping/pong, パスワードは ubuntu とすると楽)
- パスワード認証を使う
- オプションは変更なし
- 「保存」をクリックし、 「はい」をクリック
SD への書き込みが終了するのを待つ
Open SD's /etc/apt/apt.conf.d/20auto-upgrades
and make changes like following,
Before
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
After
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";
Make /etc/netplan/99-custom-network.yaml
and write following,
network:
version: 2
renderer: networkd
ethernets:
eth0:
optional: true
dhcp4: false
dhcp6: false
addresses:
- 192.168.0.101/24
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses:
- 192.168.0.1
wlan0:
optional: true
- Installs needs WAN access, so we need to give the WAN accessible static IP, router's and name server's IP.
- ex. ping's IP is '192.168.0.101', pong's IP is '192.168.0.102'
- make rpi4 accessible with SSH
┌────┐
│PING├────────┐
└────┘ │
│
┌─┴─┐ ┌────┐
│HUB├─────────┤HOST│
└─┬─┘ └────┘
│
┌────┐ │
│PONG├────────┘
└────┘
You need to access ping/pong with SSH by hand first time to resolve fingerprints.
- run ansible playbooks, main.yml, on host.
ansible-playbook -i inventory.yml main.yml
It's also possible to specify a playbook directly.
ansible-playbook -i inventory.yml playbooks/measurer-playbook.yml
- ansible.cfg is ansible's configuration file, which is INI file.
- inventory.yml is target machine settings.
- main.yml is recipes for target.