script and README to start routeros configured for pppoe
This commit is contained in:
parent
7a4314baee
commit
d284179272
3 changed files with 64 additions and 0 deletions
28
tests/support/ppp-server/README.md
Normal file
28
tests/support/ppp-server/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# ppp-server
|
||||
|
||||
To test a router, we need an upstream connection. In this directory,
|
||||
find
|
||||
|
||||
* run.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
|
||||
|
||||
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
|
||||
|
||||
config.networking.firewall.extraCommands = ''
|
||||
ip46tables -A nixos-fw -m pkttype --pkt-type multicast -p udp --dport 1234:1236 -j nixos-fw-accept
|
||||
'';
|
||||
|
||||
## 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
|
12
tests/support/ppp-server/chr.sh
Executable file
12
tests/support/ppp-server/chr.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
/nix/store/ydwiiagdhczynh2lbqh418rglibv93rv-qemu-host-cpu-only-7.0.0/bin/qemu-kvm \
|
||||
-M q35 -display none \
|
||||
-m 1024 \
|
||||
-accel kvm \
|
||||
-daemonize \
|
||||
-serial unix:qemu-console,server,nowait -monitor unix:qemu-monitor,server,nowait \
|
||||
-drive file=chr-7.5.img,format=raw,if=virtio \
|
||||
-netdev socket,id=access,mcast=230.0.0.1:1234 \
|
||||
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:11:02 \
|
||||
-netdev socket,id=world,mcast=230.0.0.1:1236 \
|
||||
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=world,mac=ba:ad:1d:ea:11:01
|
24
tests/support/ppp-server/routeros.config
Normal file
24
tests/support/ppp-server/routeros.config
Normal file
|
@ -0,0 +1,24 @@
|
|||
# sep/23/2022 21:05:02 by RouterOS 7.5
|
||||
# software id =
|
||||
#
|
||||
# run "/export show-sensitive" to recreate this
|
||||
#
|
||||
/interface ethernet
|
||||
set [ find default-name=ether1 ] disable-running-check=no name=access
|
||||
set [ find default-name=ether2 ] disable-running-check=no name=world
|
||||
/disk
|
||||
set sata1 disabled=no
|
||||
/interface wireless security-profiles
|
||||
set [ find default=yes ] supplicant-identity=MikroTik
|
||||
/ip pool
|
||||
add name=pppoe-pool ranges=192.168.100.10-192.168.100.99
|
||||
/port
|
||||
set 0 name=serial0
|
||||
/ppp profile
|
||||
add local-address=192.168.100.1 name=pppoe-profile remote-address=pppoe-pool
|
||||
/interface pppoe-server server
|
||||
add default-profile=pppoe-profile disabled=no interface=access service-name=internet
|
||||
/ip dhcp-client
|
||||
add interface=*1
|
||||
/ppp secret
|
||||
add name=db123@a.1 password=NotReallyTheSecret profile=pppoe-profile service=pppoe
|
Loading…
Reference in a new issue