- TFTP server
- Network boot files: netboot images
- DHCP server
- NAT
wifi
Mobile (mobile DHCP) Laptop Old Desktop
[192.168.43.1] ---------------- [wlan0: 192.168.43.129]
(internet hotspot) [eth0: 192.168.1.1] ----------------- [eth0: 192.168.1.205]
(our DHCP)
LAN cable
Laptop (eth0:
192.168.1.1
) serves as DHCP server and TFTP server for installing Ubuntu over network on the old desktop.
Old Desktop is where Ubuntu must be installed over network. Laptop is the base computer using which ubuntu will be installed on the old desktop. All the setup steps mentioned here are carried out on the laptop running Ubuntu 18.04.
Install TFTP server:
sudo apt update && sudo apt install tftpd-hpa
Verify config of tftpd: /etc/default/tftpd-hpa
$ cat /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
Download the relevant netboot.tar.gz
based on ubuntu version and system architecture: netboot images.
Verify that the TFTP directory path /var/lib/tftpboot
exists. If not then create by sudo mkdir -p /var/lib/tftpboot
Extract the contents of the downloaded netboot.tar.gz
in the TFTP directory.
sudo tar -xvzf netboot.tar.gz -C /var/lib/tftpboot/
Start TFTP server:
sudo systemctl start tftpd-hpa.service
Install DHCP server: isc-dhcp-server
sudo apt update && sudo apt install isc-dhcp-server
DHCP config: /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.200 192.168.1.210;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
authoritative;
}
host test_dhcp_server {
hardware ethernet 34:xx:xx:xx:xx:xx;
fixed-address 192.168.1.1;
}
group {
next-server 192.168.1.1;
host old_pc_client {
hardware ethernet 00:xx:xx:xx:xx:xx;
fixed-address 192.168.1.205;
filename "pxelinux.0";
}
}
Choose (set) a network interface for DHCP server in /etc/default/isc-dhcp-server
INTERFACESv4="eth0"
INTERFACESv6="eth0"
DHCP server will fail to start if the IP of server is not set. Assign a (temporary) static IP for the network interface to be used as DHCP server:
sudo ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
Start the DHCP server:
sudo systemctl start isc-dhcp-server.service
Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
Set IP tables for forwarding:
sudo /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo /sbin/iptables -A FORWARD -i wlan00 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
- https://help.ubuntu.com/18.04/installation-guide/amd64/ch04s05.html
- https://isabelcastillo.com/install-ubuntu-from-local-network-boot
- https://unix.stackexchange.com/questions/569715/dnsmasq-gives-unknown-interface
- https://linuxhint.com/pxe_boot_ubuntu_server/
- https://www.revsys.com/writings/quicktips/nat.html