convert routeros pppoe service to a derivation

and make it configure itself automatically instead of starting
out blank
This commit is contained in:
Daniel Barlow
2023-02-05 17:35:41 +00:00
parent 00aa42b803
commit 16a923f58f
5 changed files with 332 additions and 37 deletions

View File

@@ -1,28 +1,26 @@
# ppp-server
To test a router, we need an upstream connection. In this directory,
find
To test a router, we need an upstream connection. This directory
contains a derivation to download, start and configure a RouterOS
"Cloud Hosted Router" instance in a Qemu VM. It is currently
set up for automated tests only, and may require some manual
frobbing to run interactively.
* chr.sh, a script that will start a RouterOS image in qemu.
Login when prompted, username is "admin", blank password
* routeros.config, a set of commands you can feed into routeros
to set up PPPoE
Note that you need to open some multicast ports if you're using the
NixOS firewall (or probably, any other firewall). For iptables you can
accomplish this by editing your configuration.nix or some module it
calls:
To get the chr-7.5.img image, visit https://mikrotik.com/download and
look in the section titled "Cloud Hosted Router" for "Raw disk image"
You may need to open your firewall a bit to allow multicast packets
so that the upstream and the liminix qemu instances may communicate
```
networking.firewall.extraCommands = ''
ip46tables -A nixos-fw -m pkttype --pkt-type multicast -p udp --dport 1234:1236 -j nixos-fw-accept
'';
```
config.networking.firewall.extraCommands = ''
ip46tables -A nixos-fw -m pkttype --pkt-type multicast -p udp --dport 1234:1236 -j nixos-fw-accept
'';
## Provenance
## To connect to the routeros serial
The Qemu instance running RouterOS is headless, but it creates
two unix sockets for serial port and monitor.
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f tests/support/ppp-server/qemu-console
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f tests/support/ppp-server/qemu-monitor
The chr-7.x.img image is taken from https://mikrotik.com/download -
look in the section titled "Cloud Hosted Router" for "Raw disk image".
Note that this is proprietary software: please read the license
information and make sure you're using it legally.