Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / ubuntu-autoinstall.ipxe
Last active February 23, 2023 15:22
Ubuntu 20.04 autoinstall (casper/subiquity/curtin) to iPXE - work-in-progress (not fully working for iSCSI)
:ubuntu-autoinstall
echo Starting Ubuntu ${ubuntu-version} ${archl} autoinstaller for ${initiator-iqn}
sanhook ${base-iscsi}:${hostname}.boot.ubuntu || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-cc-iscsi storage: { layout: { name: lvm }, config: [{type: disk, path: ${base-iscsi}:${hostname}.boot.ubuntu }] } || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-iscsi ISCSI_INITIATOR=${initiator-iqn} ISCSI_TARGET_NAME=${base-iqn}:${hostname}.boot.ubuntu ISCSI_TARGET_IP=${iscsi-server} ISCSI_TARGET_PORT=3260 || sleep 1
# https://medium.com/@tlhakhan/ubuntu-server-20-04-autoinstall-2e5f772b655a
# https://ubuntu.com/server/docs/install/autoinstall
# https://github.com/canonical/cloud-init/blob/master/doc/examples/kernel-cmdline.txt
# https://matt.olan.me/raspberry-pi-iscsi-root-on-ubuntu-20-04/
# https://askubuntu.com/questions/1235723/automated-20-04-server-installation-using-pxe-and-live-server-image
@robinsmidsrod
robinsmidsrod / gist:35894f5fbaef210869d2b40759654f24
Created February 2, 2023 17:02
Informasjon om Altibox IPTV oppsett med egen router
Jeg fant på https://forum.openwrt.org/t/help-getting-iptv-working-with-the-altibox-isp/38063/24?page=2 litt informasjon som jeg har skrevet om litt etter informasjon fra @trrunde (diskusjon.no).
The requirements for forwarding Altbox IPTV and Internet between fiber (with SFP or media converter) and a shared lan with both STBs and Internet clients are simple:
* tag VLAN 101 (IPTV) and 102 (Internet) on wan
* clone mac address of ISP gateway/router on the wan.101 interface
* run DHCP client on both wan.101 and wan.102
* SNAT/masquerade between lan and both wan interfaces
* igmpproxy between wan.101 (upstream) and lan (downstream)
@robinsmidsrod
robinsmidsrod / ipxe.sh
Created August 3, 2016 14:49
Bash functions for building iPXE in different ways
#!/bin/bash
make_ipxe() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=chain bin/undionly.kpxe bin/ipxe.lkrn bin/ipxe.pxe bin/ipxe.usb &&
sudo install -v -m 0644 -g root -o root bin/undionly.kpxe /srv/salt/tftpd/files/undionly.kpxe &&
sudo install -v -m 0644 -g root -o root bin/ipxe.lkrn /srv/salt/tftpd/files/ipxe.lkrn &&
sudo install -v -m 0644 -g root -o root bin/ipxe.pxe /srv/salt/tftpd/files/ipxe.pxe &&
sudo salt-call -l quiet state.single file.recurse name=/srv/tftp source=salt://tftpd/files dir_mode=755 file_mode=644 &&
popd >/dev/null
@robinsmidsrod
robinsmidsrod / error.txt
Created March 28, 2012 08:42
Booting SmartOS 20120309T073819Z directly from iPXE (aac9718) gives error
Download of kernel+initrd works on real hardware (HP/Compaq 6730b),
but this message comes up after a few seconds.
================================
krtld: failed to open 'unix'
krtld: bind_primary(): no relocation information found for module unix
krtld: error during initial load/link phase
krtld could neither locate nor resolve symbols for:
unix
@robinsmidsrod
robinsmidsrod / remote_logging.conf
Created July 4, 2012 09:02
rsyslogd setup for remote logging
$ cat /etc/rsyslog.d/remote_logging.conf
# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514
# Limits reception to our subnet
$AllowedSender UDP, 10.1.1.0/24
$AllowedSender TCP, 10.1.1.0/24
@robinsmidsrod
robinsmidsrod / README.md
Created October 9, 2012 13:32
Testing out the upcoming NFS support in iPXE
@robinsmidsrod
robinsmidsrod / coreos.ipxe
Last active August 13, 2022 00:05
CoreOS iPXE recipe
#!ipxe
set coreos-version 72.0.0
echo Booting CoresOS ${coreos-version}
set base-url http://storage.core-os.net/coreos/amd64-generic/${coreos-version}
kernel ${base-url}/coreos_production_pxe.vmlinuz
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
imgargs coreos_production_pxe.vmlinuz root=squashfs: state=tmpfs: sshkey="ssh-dss AAAAB3NzaC1kc3MAAAEBAL/ga3he0R/MiWa8LM0L/i29m3v6cxv65h6vFwrR4UYkAtqW6H597YBNKwi0Egw5KUC0Cw/BaRY0rAP9IKD7BQ+uh1r8kiGDRO71qrTdXYSfZs4UWjzwN41GrFJMPu2tb4kFOZqsOgmGA9RjapgWRKUWzCgBmq36R2VeF2uf4MWFZWFCpiNv4lekahn3Vch0iWNDZXyUrAAj/iSRgYV2cdzUgmz8IzIODc5wdRBflB9M+osiL8+7/9cUoyv3SFx5uqnozSan0wR+Y4FcLWcqJ7PYvYv3MqHmdp9cd3Py+wmRza+xan+XYCOkO/K/yahVb+j3MQ9AT8KKx48Yq0iiBGsAAAAVANkbdfmZMTo1tNDT3Up0AWPpmCYbAAABADbLWxgYPl8lG7VNpDZGBOmz6djY4ZDX8lx50kL09T37wZWUCGVzKcEwozoekgTxs1hYIfki7+AsqhqlMA66A0hHCCmKYqqErbRAq6OKmdDdpjwwPfsH4ghbqRyIwoXL4uydlYfgEBeqB+a1j6UErtzKPb8thNPcMz42j9eZAg5Lu7fv5yZsxP5KtfGlBuun0trmTCDksA2D38JHY6Ktu11bMIq8++J3wNMUobl9JpVnh2BQZn2pJ4SNIUO+EhXRBDjxRVsSM1fcfnN2IgPFEFlflsutyJt
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Created September 11, 2015 06:31
Simplest way of chainloading iPXE for both UEFI and legacy BIOS with ISC dhcpd
option arch code 93 = unsigned integer 16;
next-server X.X.X.X;
if option arch = 00:07 {
filename "ipxe.efi";
}
else {
filename "undionly.kpxe";
#filename "ipxe.pxe"; # if you prefer native drivers
}
@robinsmidsrod
robinsmidsrod / nic-menu.ipxe
Created April 7, 2016 10:46
iPXE embedded menu that tries to boot each network adapter in turn
#!ipxe
set timeout 1000
:menu
menu Network boot options for ${uuid}
item --key a default Try to boot (a)ll network adapters in turn
item
item --gap -- --- Detected network adapters ---
set i:int8 0
@robinsmidsrod
robinsmidsrod / debug.out.strace
Last active March 15, 2022 14:45
Perl 5.34.1 test suite failure with Time::HiRes on Ubuntu 18.04 on Azure VM
execve("/home/portfolio/perlbrew/perls/perl-5.34.1/bin/perl", ["perl", "t/stat.t"], 0x7ffdd9beab48 /* 48 vars */) = 0
brk(NULL) = 0x563492d8d000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd57eb6b000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/x86_64", 0x7ffe2d377500) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/portfolio