Skip to content

Commit f069168

Browse files
committed
PXE boot config files
1 parent 2339308 commit f069168

8 files changed

+208
-68
lines changed

config/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Config Files
2+
3+
## embed.ipxe
4+
5+
The `embed.ipxe` file is used to build the iPXE `undionly.kpxe` binary with the `embed.ipxe` embedded inside. This PXE booter will chainload to `tftp://192.168.88.1/preseed.ipxe`. This makes it easier for us to make edits to the iPXE script without having to rebuild the iPXE binary. See http://ipxe.org/embed for information on building the binary with the embedded script.
6+
7+
## preseed.cfg
8+
9+
This is the main Ubuntu preseed file. It automates the installation of Ubuntu for us so we don't need a keyboard or monitor. This gets passed to the `url` parameter as a kernel command line option at boot. See the `preseed.ipxe` script for the command line that gets passed.
10+
11+
## preseed.ipxe
12+
13+
This is the chainloaded iPXE script. We use this to pull down a remote Ubuntu installer image and boot using our `preseed.cfg` file. The installation procdes automatically and shuts down the node when done (so we can disable the TFTP options before we next power on).
14+
15+
## preseed.kpxe
16+
17+
This is the `undionly.kpxe` file with our embedded `embed.ipxe` script. It was generated using instructions at http://ipxe.org/embed and then renamed from `undionly.kpxe` to `preseed.kpxe`.
18+
19+
## ros_default.rsc
20+
21+
This is the default configuration of the MikroTik hEX before any of our edits. It is just here for reference.
22+
23+
## ros_kuberdoo.rsc
24+
25+
This is the MikroTik hEX configuration with our edits. It can be applied on top of the default MikroTik configuration. You will likely want to change the DHCP lease MAC addresses of the boards and the global password at top (which is used for VPN and admin functions).

config/default_vpn.rsc

-68
This file was deleted.

config/embed.ipxe

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!ipxe
2+
dhcp
3+
chain tftp://192.168.88.1/preseed.ipxe

config/preseed.cfg

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# See https://help.ubuntu.com/16.04/installation-guide/amd64/apb.html for preseeding documentation
2+
# See https://help.ubuntu.com/16.04/installation-guide/amd64/apbs04.html for all preseed options
3+
4+
d-i debian-installer/locale string en_US
5+
d-i debian-installer/locale string en_US.UTF-8
6+
d-i console-setup/ask_detect boolean false
7+
d-i keyboard-configuration/xkb-keymap select us
8+
d-i keyboard-configuration/layout select English (US)
9+
d-i keyboard-configuration/modelcode string pc105
10+
11+
d-i netcfg/choose_interface select auto
12+
d-i netcfg/get_hostname string pixiecore
13+
d-i netcfg/get_domain string kuberdoo
14+
d-i netcfg/wireless_wep string
15+
16+
d-i mirror/country string manual
17+
d-i mirror/http/hostname string mirror.us.leaseweb.net
18+
d-i mirror/http/directory string /ubuntu
19+
d-i mirror/http/proxy string
20+
#d-i mirror/http/mirror select us.archive.ubuntu.com
21+
22+
d-i passwd/user-fullname string Kuberdoo User
23+
d-i passwd/username string ubuntu
24+
d-i passwd/user-password password kub3rd00
25+
d-i passwd/user-password-again password kub3rd00
26+
d-i user-setup/encrypt-home boolean false
27+
28+
d-i clock-setup/utc boolean true
29+
d-i time/zone string America/Chicago
30+
d-i clock-setup/ntp boolean true
31+
32+
d-i partman-auto/method string lvm
33+
d-i partman-lvm/device_remove_lvm boolean true
34+
d-i partman-md/device_remove_md boolean true
35+
d-i partman-lvm/confirm boolean true
36+
d-i partman-lvm/confirm_nooverwrite boolean true
37+
d-i partman-auto-lvm/guided_size string max
38+
d-i partman-auto/choose_recipe select atomic
39+
d-i partman-partitioning/confirm_write_new_label boolean true
40+
d-i partman/choose_partition select finish
41+
d-i partman/confirm boolean true
42+
d-i partman/confirm_nooverwrite boolean true
43+
d-i partman-md/confirm boolean true
44+
d-i partman-partitioning/confirm_write_new_label boolean true
45+
d-i partman/choose_partition select finish
46+
d-i partman/confirm boolean true
47+
d-i partman/confirm_nooverwrite boolean true
48+
49+
# Setup passwordless sudo for ubuntu user
50+
d-i preseed/late_command string echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/ubuntu
51+
52+
tasksel tasksel/first multiselect none
53+
d-i base-installer/kernel/image string linux-generic-hwe-16.04
54+
d-i pkgsel/include string openssh-server
55+
d-i pkgsel/update-policy select none
56+
popularity-contest popularity-contest/participate boolean false
57+
d-i pkgsel/updatedb boolean false
58+
d-i grub-installer/only_debian boolean true
59+
d-i grub-installer/with_other_os boolean true
60+
d-i finish-install/reboot_in_progress note
61+
d-i debian-installer/exit/poweroff boolean true

config/preseed.ipxe

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!ipxe
2+
kernel --name kernel http://mirror.leaseweb.net/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
3+
initrd --name initrd http://mirror.leaseweb.net/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
4+
boot kernel initrd=initrd auto=true hostname=preseed domain=kuberdoo keymap=us url=tftp://192.168.88.1/preseed.cfg

config/preseed.kpxe

65.4 KB
Binary file not shown.

config/ros_default.rsc

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# oct/27/2017 14:55:31 by RouterOS 6.40.4
2+
# software id = 8K0S-Z4TM
3+
#
4+
# model = RouterBOARD 750G r3
5+
# serial number = 6F39078102EC
6+
/interface ethernet
7+
set [ find default-name=ether2 ] name=ether2-master
8+
set [ find default-name=ether3 ] master-port=ether2-master
9+
set [ find default-name=ether4 ] master-port=ether2-master
10+
set [ find default-name=ether5 ] master-port=ether2-master
11+
/ip neighbor discovery
12+
set ether1 discover=no
13+
/interface list
14+
add comment=defconf name=WAN
15+
add comment=defconf name=LAN
16+
/interface wireless security-profiles
17+
set [ find default=yes ] supplicant-identity=MikroTik
18+
/ip hotspot profile
19+
set [ find default=yes ] html-directory=flash/hotspot
20+
/ip pool
21+
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
22+
/ip dhcp-server
23+
add address-pool=default-dhcp disabled=no interface=ether2-master name=defconf
24+
/interface list member
25+
add comment=defconf interface=ether2-master list=LAN
26+
add comment=defconf interface=ether1 list=WAN
27+
/ip address
28+
add address=192.168.88.1/24 comment=defconf interface=ether2-master network=192.168.88.0
29+
/ip dhcp-client
30+
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=ether1
31+
/ip dhcp-server network
32+
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
33+
/ip dns
34+
set allow-remote-requests=yes
35+
/ip dns static
36+
add address=192.168.88.1 name=router.lan
37+
/ip firewall filter
38+
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
39+
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
40+
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
41+
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
42+
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
43+
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
44+
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
45+
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
46+
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
47+
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
48+
/ip firewall nat
49+
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
50+
/system clock
51+
set time-zone-name=America/Chicago
52+
/system routerboard mode-button
53+
set enabled=no on-event=""
54+
/tool mac-server
55+
set [ find default=yes ] disabled=yes
56+
add interface=ether2-master
57+
/tool mac-server mac-winbox
58+
set [ find default=yes ] disabled=yes
59+
add interface=ether2-master

config/ros_kuberdoo.rsc

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
:global password "kub3rd00"
2+
/ip pool
3+
set [ find name=default-dhcp ] ranges=192.168.88.50-192.168.88.254
4+
add name=vpn ranges=192.168.89.2-192.168.89.254
5+
/ip dhcp-server
6+
set [ find name=defconf ] address-pool=default-dhcp authoritative=after-2sec-delay disabled=no interface=ether2-master name=kuberdoo
7+
/ip dhcp-server option
8+
add code=12 name=hostname-udoo1 value="'udoo1'"
9+
add code=12 name=hostname-udoo2 value="'udoo2'"
10+
add code=12 name=hostname-udoo3 value="'udoo3'"
11+
add code=12 name=hostname-udoo4 value="'udoo4'"
12+
add code=12 name=hostname-udoo5 value="'udoo5'"
13+
add code=12 name=hostname-udoo6 value="'udoo6'"
14+
add code=66 name=tftp-server value="'192.168.88.1'"
15+
add code=67 name=file-netboot value="'netboot.xyz.kpxe'"
16+
add code=67 name=file-preseed value="'preseed.kpxe'"
17+
/ip dhcp-server option sets
18+
add name=boot-netboot options=file-netboot,tftp-server
19+
add name=boot-preseed options=file-preseed,tftp-server
20+
/ip dhcp-server lease
21+
add address=192.168.88.11 always-broadcast=yes dhcp-option=hostname-udoo1 mac-address=00:C0:08:90:58:5A server=kuberdoo
22+
add address=192.168.88.12 always-broadcast=yes dhcp-option=hostname-udoo2 mac-address=00:C0:08:90:38:0B server=kuberdoo
23+
add address=192.168.88.13 always-broadcast=yes dhcp-option=hostname-udoo3 mac-address=00:C0:08:90:38:C5 server=kuberdoo
24+
add address=192.168.88.14 always-broadcast=yes dhcp-option=hostname-udoo4 mac-address=00:C0:08:90:58:6B server=kuberdoo
25+
add address=192.168.88.15 always-broadcast=yes dhcp-option=hostname-udoo5 mac-address=00:C0:08:90:57:AF server=kuberdoo
26+
add address=192.168.88.16 always-broadcast=yes dhcp-option=hostname-udoo6 mac-address=00:C0:08:90:58:59 server=kuberdoo
27+
/ip dhcp-server network
28+
set [ find address="192.168.88.0/24" ] next-server=192.168.88.1 boot-file-name=netboot.xyz.kpxe
29+
/ppp profile
30+
set *FFFFFFFE dns-server=192.168.89.1 local-address=192.168.89.1 remote-address=vpn
31+
/interface l2tp-server server
32+
set enabled=yes ipsec-secret="$password" use-ipsec=yes
33+
/ip firewall filter
34+
add place-before=[ find comment="defconf: drop all not coming from LAN" ] action=accept chain=input comment="kuberdoo: allow l2tp" dst-port=1701,500,4500 protocol=udp
35+
add place-before=[ find comment="defconf: drop all not coming from LAN" ] action=accept chain=input comment="kuberdoo: allow l2tp ipsec" protocol=ipsec-esp
36+
add place-before=[ find comment="defconf: drop all not coming from LAN" ] action=accept chain=input comment="kuberdoo: external management" dst-port=80,22 protocol=tcp
37+
/ip firewall nat
38+
add action=masquerade chain=srcnat comment="kuberdoo: vpn traffic" src-address=0.89.168.192-255.89.168.192
39+
/ip tftp
40+
add real-filename=flash/netboot.xyz.kpxe req-filename=netboot.xyz.kpxe
41+
add real-filename=flash/preseed.cfg req-filename=preseed.cfg
42+
add real-filename=flash/preseed.kpxe req-filename=preseed.kpxe
43+
add real-filename=flash/preseed.ipxe req-filename=preseed.ipxe
44+
/ppp secret
45+
add name=vpn password="$password"
46+
/interface l2tp-server
47+
add name=l2tp-in1 user=""
48+
/system identity
49+
set name=kuberdoo
50+
/tool
51+
fetch https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe dst-path=flash
52+
fetch https://github.com/andyshinn/kuberdoo/blob/master/config/preseed.cfg dst-path=flash
53+
fetch https://github.com/andyshinn/kuberdoo/blob/master/config/preseed.ipxe dst-path=flash
54+
fetch https://github.com/andyshinn/kuberdoo/blob/master/config/preseed.kpxe dst-path=flash
55+
/user
56+
set [ find name=admin ] password="$password

0 commit comments

Comments
 (0)