Difference between pages "Linux basics" and "DVDless install"

From Wikislax
(Difference between pages)
Jump to: navigation, search
 
(Firewalling NFS)
 
Line 1: Line 1:
== Using VI ==
+
{{RightTOC}}
  
'''vi''' (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit surprising. Actually, '''vi''' was created at a time when the keyboards did not have any arrow or insert keys. So there are two modes: the «open» mode and the «insert» mode.
+
The (local) network is an additional choice to install Slackware from when your hardware has this capability. Installing from the local network is much faster than from a DVD and is a good choice when playing around with the installation. This page explains how to configure a Slackware server for this usage. It was inspired by the [http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:pxe AlienBob's blog page] on the same topic. To install Slackware over the network we need :
  
The open mode affords moving the cursor. '''j''', '''k''', '''l''', '''m''' move the cursor by one character. '''ctrl-f''' moves one page forward and '''ctrl-b''' moves one page backwards. '''w''' moves one word forward and  '''b''' moves one word backwards. It is also possible to use the arrow keys.
+
* A service to download the Slackware files during the Slackware setup. HTTP, FTP, or NFS can be used. In the example below we show how to use the NFS and FTP services included with Slackware.
 +
* A service implementing the TFTP protocol. TFTP is used to effectively download the bootstrap code from the server identified. We will use the TFTP protocol included with Slackware.
  
'''i''' goes into insert mode before the cursor, '''a''' goes into insert mode after the cursor, and '''A''' goes into insert mode at the end of the line. '''o''' adds a line after the current line, and '''O''' adds a live before the current line. '''R''' goes into rewrite mode.
+
* A service implementing the BOOTP protocol. BOOTP is used by the PXE firmware to identify on the network a server to download the bootloader code from. The DHCP server included with the Slackware distribution has this capability.
  
'''esc''' affords getting out of the insert mode.
+
== Configuring NFS ==
  
'''c$''' affords replacing the end of the line and '''d$''' affords deleting the end of the line. '''cw''' affords replacing one word and '''dw''' affords deleting one word. '''dd''' affords deleting the current line.
+
NFS is SUN's Network File System. It is lightning fast and can be used as a mount point, but depending on configuration may be unsecure and must be used locally only. Also, it uses some random port numbers that need to be fixed if firewalling. The directories used are defined in '''/etc/exports'''. Edit as follows. '''ro''' means read-only, '''sync''' makes sure that no asynchronous requests are made, '''insecure''' affords using different NFS ports from other NFS implementations, '''all_squash''' maps all uids and gids to the anonymous user for public access, '''no_subtree_check''' improves reliability in some circumstances. See '''man exports''' for more details.
  
''':q''' affords quitting without saving. If the file has been modified, quitting must be forced by typing ''':q!'''. ''':x''' affords saving and quitting. If the file does not have the write rigths, saving must be forced by typing ''':x!'''. ''':w''' affords writing the text in a new file. If the new file already exists, writing must be forced by typing ''':w!'''.
+
# See exports(5) for a description.
 +
# This file contains a list of all directories exported to other computers.
 +
# It is used by rpc.nfsd and rpc.mountd.
 +
 +
/var/pub      192.168.53.1/24(ro,sync,insecure,all_squash,no_subtree_check)
  
''':num''' affords moving to the line number num. ''':$''' affords moving to the end of the file.
+
The NFS server is launched using '''/etc/rc.d/rc.nfsd'''. Make this script executable so as to use it on every boot. You can also '''start''' it to test it immediately. The NFS client is launched using '''/etc/rc.d/rc.rpc''' and affords using NFS mount points from other NFS servers. Make this script executable if you want to use it and have it started on every reboot. This can be handy to cross-test NFS machines. Otherwise it should not be necessary.
''':num1copynum2''' affords copying the line number num1 after the line number num2. ''':num1mnum2''' affords moving the line number num1 after the line number num2.
 
  
For detailed information, check the [http://vimdoc.sourceforge.net/htmldoc/help.html VIM Documentation]. To enter special characters check the page on [http://vimdoc.sourceforge.net/htmldoc/digraph.html digraphs]. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
+
# chmod u+x /etc/rc.d/rc.nfsd
 +
# chmod u+x /etc/rc.d/rc.rpc
  
== Using SSH ==
+
== Configuring FTP ==
  
SSH is a suite of tools affording connecting remotely over encrypted communications. On the client side, '''ssh''' offers a command line terminal, '''scp''' affords copying a file, and '''sftp''' behaves like ftp. The server side consists of sshd, sftp-server, and ssh-agent. ssh-add, ssh-keysign, ssh-keyscan, and ssh-keygen afford key management. The SSH present on Slackware and the BSDs is [https://www.openssh.com/ OpenSSH], developped by members of the [https://www.openbsd.org/ OpenBSD] project.
+
As SSH affords encrypted authentication and transfers, FTP will be used on our site only for anonymous public downloads. FTP uses fixed port numbers so it is easy to firewall, but it is much slower than NFS. Slackware includes two FTPs : ProFTPd and vsFTP. We will use the latter. Using vsFTP requires very little configuration : setting the home directory of the ftp user to where we want our files to be downloaded from, uncommenting the correct '''ftp''' line in '''/etc/inetd.conf''' and '''/etc/rc.d/rc.inetd restart''', updating the firewall rules. For more details '''man vsftpd.conf'''.
 +
 +
# usermod --home /var/pub ftp
 +
. . .  
 +
# Very Secure File Transfer Protocol (FTP) server.
 +
ftp    stream  tcp    nowait  root    /usr/sbin/tcpd  vsftpd
 +
. . .
 +
# /etc/rc.d/rc.inetd restart
 +
. . .
 +
# services on local network FTP BOOTP HTTP NNTP IMAP HTTPS SUBMIT VNC VOIP
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 20 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 21 -m state --state NEW -s 192.168.0.0/16
  
'''ssh''' obviously requires your connection password every time it is executed. This can be avoided by creating on the client a pair of rsa keys and copying the public key to the server. Not specifying a passphrase is not very secure but will afford avoiding having to enter it every time :
+
== Putting the Slackware install files online ==
  
# '''ssh-keygen -t rsa'''
+
Copy the content of the slackware DVD to a disk directory, for instance '''/var/pub/slackware64-15.0'''
Generating public/private rsa key pair.
 
Enter file in which to save the key (/root/.ssh/id_rsa): '''<cr>'''
 
Enter passphrase (empty for no passphrase): '''<cr>'''
 
Enter same passphrase again: '''cr>'''
 
Your identification has been saved in /root/.ssh/id_rsa.
 
Your public key has been saved in /root/.ssh/id_rsa.pub.
 
The key fingerprint is:
 
SHA256:ATSDdER5/l8OJvr+jpINIReJtd81zntVbTjuJW5aobE root@client
 
The key's randomart image is:
 
+---[RSA 2048]----+
 
..=O+..      |
 
|    ..o++.    ..|
 
|      oo.    = +|
 
|      . +o . = +.|
 
|      oSo. o * o|
 
|        . o o*.=.|
 
|        = +E+* .|
 
|        + ...+.. |
 
|        ++o+    |
 
+----[SHA256]-----+
 
# '''scp root@client:.ssh/id_rsa.pub root@server:.ssh/id_rsa.pub'''
 
password: '''secret<cr>'''
 
id_rsa.pub                                          100% 394      1.8MB/s  00:00
 
# '''ssh server'''
 
password: '''secret<cr>'''
 
# '''cd .ssh'''
 
# '''cat >> authorized_keys < id_rsa.pub'''
 
# '''chmod 600 authorized_keys'''
 
# '''rm id_rsa.pub'''
 
  
== Useful linux commands ==
+
# mkdir /mnt/dvd
 +
# mkdir /var/pub/slackware64-15.0
 +
# mount -o loop slackware64-15.0-install-dvd.iso /mnt/dvd
 +
# cp -a /mnt/dvd/* /var/pub/slackware64-15.0/
 +
# umount /mnt/dvd
  
{| {{thead}}
+
During install, when asked for the source directory specify subdirectory '''slackware64''' that is, '''/var/pub/slackware64-15.0/slackware64'''
|-
 
! {{chead}} width="220" | Command
 
! {{chead}} | Effect
 
|-
 
|<tt>'''cd'''</tt>||change directory.
 
|-
 
|<tt>'''chmod -R ppp ddd'''</tt>||recursively change permissions on file or directory.
 
|-
 
|<tt>'''chown -R uuu:ggg ddd'''</tt>||recursively change user:group ownership on file or directory.
 
|-
 
|<tt>'''chgrp -R ggg ddd'''</tt>||recursively change group ownership on file or directory.
 
|-
 
|<tt>'''command xxx <nowiki>|</nowiki> grep yyy'''</tt>||search for string yyy in output of command xxx.
 
|-
 
|<tt>'''ethtool -s eth0 wol g'''</tt>||puts interface eth0 in wake-on-lan status.
 
|-
 
|<tt>'''find xxx -name yyy -print'''</tt>||find file yyy in in subdirectories of xxx.
 
|-
 
|<tt>'''killall xxx'''</tt>||kill program named xxx.
 
|-
 
|<tt>'''ldconfig'''</tt>||reload libraries taking into account new libraries just built.
 
|-
 
|<tt>'''ln -s existing new'''</tt>||create a symbolic link new to an existing directory or file.
 
|-
 
|<tt>'''ls -al'''</tt>||list the working directory, including files beginning with a dot.
 
|-
 
|<tt>'''man xxx'''</tt>||display the xxx command manual page.
 
|-
 
|<tt>'''more xxx'''</tt>||display file xxx with the possibility of moving up and down. '''less''' and '''most''' are similar commands.
 
|-
 
|<tt>'''mount -t ttt /dev/xxx /mnt/ddd'''</tt>||mount device xxx as type ttt under directory ddd.
 
|-
 
|<tt>'''(u)mount /mnt/ddd'''</tt>||(u)mount device ddd as specified in /etc/fstab.
 
|-
 
|<tt>'''nmap <i>host</i>'''</tt>||check filtering status of ports on <i>host</i>. '''-sU''' for UDP.
 
|-
 
|<tt>'''ps -ef'''</tt>||list the running processes.
 
|-
 
|<tt>'''pwd'''</tt>||print working directory.
 
|-
 
|<tt>'''rm -r'''</tt>||remove file or directory recursively.
 
|-
 
|<tt>'''screen <i>-S<name></i>'''</tt>||screen offers a frame to run a shell, detach from it (<ctrl>-a d) and later reattach to it.
 
|-
 
|<tt>'''ssh <i>host</i>'''</tt>||connect remotely to site <i>host</i>.
 
|-
 
|<tt>'''su -l uuuu'''</tt>||execute shell as another user. if -l is used an environment similar to what the other user would have had with a direct login is provided.
 
|-
 
|<tt>'''telinit n'''</tt>||go to the runlevel n (1=single-user, 3=multi-user, 4=graphical, 6=reboot).
 
|-
 
|<tt>'''umask'''</tt>||edit /etc/profile to change the default umask value of 022 and '''set it to 027''' (files not readable by other users), a good setting except when installing as root server software to be ran as a standard user account (permission issues).
 
|-
 
|<tt>'''vi'''</tt>||run the vi text editor. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
 
|}
 
  
<br clear=all>
+
The Slackware network setup uses NFS version 3 meaning that directory paths are absolute.
  
{{pFoot|[[Maintaining Slackware]]|[[Main Page]]|[[Configuration files]]}}
+
== Configuring TFTPBOOT ==
 +
 
 +
TFTP is the trivial ftp protocol (for use on a local network). Let's create the '''tftp bootp''' file structure under the default '''/tftpboot''' directory. The directory where we store the bootloader files is '''/tftpboot/slackware64-15.0''' :
 +
 
 +
# mkdir /tftpboot
 +
# mkdir /tftpboot/slackware64-15.0
 +
# mkdir /tftpboot/slackware64-15.0/pxelinux.cfg
 +
# cp /usr/share/syslinux/pxelinux.0 /tftpboot/slackware64-15.0/
 +
# cp /var/pub/slackware64-15.0/isolinux/message.txt /tftpboot/slackware64-15.0/
 +
# cp /var/pub/slackware64-15.0/isolinux/f2.txt /tftpboot/slackware64-15.0/
 +
# cp -a /var/pub/slackware64-15.0/kernels /tftpboot/slackware64-15.0/
 +
# cp /var/pub/slackware64-15.0/usb-and-pxe-installers/pxelinux.cfg_default /tftpboot/slackware64-15.0/pxelinux.cfg/default
 +
# cp /var/pub/slackware64-15.0/isolinux/initrd.img /tftpboot/slackware64-15.0/
 +
 
 +
Tftpboot is handled by '''inetd'''. To activate it, uncomment the tftp line in '''/etc/inetd.conf''' then '''/etc/rc.d/rc.inetd restart''' or reboot.
 +
 
 +
tftp  dgram  udp    wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize
 +
 
 +
== Configuring DHCP ==
 +
 
 +
We configure '''/etc/dhcpd.conf''' as follows. Our subnet is '''192.168.53.0''', our network mask '''255.255.255.0''', our IP address is '''192.168.53.1''', our router address '''192.168.53.254'''. The IP DHCP range is '''192.168.53.154''' to '''192.168.53.253'''. For more details on other configuration possbilities, '''man dhcpd.conf'''.
 +
 
 +
# dhcpd.conf
 +
#
 +
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
 +
#
 +
 +
# If this DHCP server is the official DHCP server for the local
 +
# network, the authoritative directive should be uncommented.
 +
authoritative;
 +
ddns-update-style none;
 +
 +
# Allow bootp requests
 +
allow bootp;
 +
 +
# Point to the TFTP server:
 +
next-server 192.168.53.1;
 +
 +
# Default lease is 1 week (604800 sec.)
 +
default-lease-time 604800;
 +
# Max lease is 4 weeks (2419200 sec.)
 +
max-lease-time 2419200;
 +
 +
subnet 192.168.53.0 netmask 255.255.255.0 {
 +
    option domain-name "studioware.com";
 +
    option broadcast-address 192.168.53.255;
 +
    option subnet-mask 255.255.255.0;
 +
    option domain-name-servers 192.168.53.1;
 +
    option routers 192.168.53.254;
 +
    range dynamic-bootp 192.168.53.154 192.168.53.253;
 +
    use-host-decl-names on;
 +
    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
 +
      filename "/slackware64-15.0/pxelinux.0";
 +
    }
 +
}
 +
 
 +
Next is to create a script '''/etc/rc.d/rc.dhcpd''' to launch dhcp. Our bridged interface is '''br0''' :
 +
 
 +
#!/bin/sh
 +
#
 +
# /etc/rc.d/rc.dhcpd
 +
#      This shell script takes care of starting and stopping
 +
#      the ISC DHCPD service
 +
#
 +
 +
# Put the command line options here that you want to pass to dhcpd:
 +
DHCPD_OPTIONS="-q '''br0'''"
 +
 +
[ -x /usr/sbin/dhcpd ] || exit 0
 +
 +
[ -f /etc/dhcpd.conf ] || exit 0
 +
 +
start() {
 +
      # Start daemons.
 +
      echo -n "Starting dhcpd:  /usr/sbin/dhcpd $DHCPD_OPTIONS "
 +
      /usr/sbin/dhcpd $DHCPD_OPTIONS
 +
      echo
 +
}
 +
stop() {
 +
      # Stop daemons.
 +
      echo -n "Shutting down dhcpd: "
 +
      killall -TERM dhcpd
 +
      echo
 +
}
 +
status() {
 +
  PIDS=$(pidof dhcpd)
 +
  if [ "$PIDS" == "" ]; then
 +
    echo "dhcpd is not running!"
 +
  else
 +
    echo "dhcpd is running at pid(s) ${PIDS}."
 +
  fi
 +
}
 +
restart() {
 +
      stop
 +
      start
 +
}
 +
 +
# See how we were called.
 +
case "$1" in
 +
  start)
 +
        start
 +
        ;;
 +
  stop)
 +
        stop
 +
        ;;
 +
  restart)
 +
        stop
 +
        start
 +
        ;;
 +
  status)
 +
        status
 +
        ;;
 +
  *)
 +
        echo "Usage: $0 {start|stop|status|restart}"
 +
        ;;
 +
esac
 +
 +
exit 0
 +
 
 +
Next is to make '''/etc/rc.d/rc.dhcpd''' executable, launch it from '''/etc/rc.d/rc.local''' and stop it from '''/etc/rc.d/rc.local_shutdown''' :
 +
 
 +
# chmod u+x rc.dhcpd
 +
. . .
 +
# start dhcpd
 +
if [ -x /etc/rc.d/rc.dhcpd ]; then
 +
        /etc/rc.d/rc.dhcpd start
 +
fi
 +
. . .
 +
# stop dhcpd
 +
if [ -x /etc/rc.d/rc.dhcpd ]; then
 +
    /etc/rc.d/rc.dhcpd stop
 +
fi
 +
 
 +
== Firewalling NFS ==
 +
 
 +
Refer to [[IPTables]] for an introduction on packet filtering. NFS uses some random ports by defaults, that we need to fix if we want to be able to do proper packet filtering. To be precise, NFS uses sunrpc/111 and nfsd/2049, and random port numbers are used by other NFS daemons but it is possible to specify alternative port numbers on the command line or in the '''/etc/services''' file, to which we add :
 +
 
 +
rpc.nfs-cb      32764/tcp  # RPC nfs callback
 +
rpc.nfs-cb      32764/udp  # RPC nfs callback
 +
status          32765/udp  # NFS status (listen)
 +
status          32765/tcp  # NFS status (listen)
 +
status          32766/udp  # NFS status (send)
 +
status          32766/tcp  # NFS status (send)
 +
mountd          32767/udp  # NFS mountd
 +
mountd          32767/tcp  # NFS mountd
 +
lockd          32768/udp  # NFS lock daemon/manager
 +
lockd          32768/tcp  # NFS lock daemon/manager
 +
rquotad        32769/udp  # NFS rquotad
 +
rquotad        32769/tcp  # NFS rquotad
 +
 
 +
The '''/etc/rc.d/rc.nfsd''' and '''/etc/rc.d/rc.rpc''' scripts are modified to specify port numbers on the command lines :
 +
 
 +
if [ -x /usr/sbin/rpc.rquotad ]; then
 +
  echo "  /usr/sbin/rpc.rquotad '''-p 32769'''"
 +
  /usr/sbin/rpc.rquotad '''-p 32769'''
 +
fi
 +
 +
if [ -x /usr/sbin/rpc.mountd ]; then
 +
  echo "  /usr/sbin/rpc.mountd '''-p 32767'''"
 +
  /usr/sbin/rpc.mountd '''-p 32767'''
 +
fi
 +
 +
if ! ps axc | grep -q rpc.statd ; then
 +
  echo "Starting RPC NSM (Network Status Monitor):  /sbin/rpc.statd '''-p 32765 -o 32766'''"
 +
  /sbin/rpc.statd '''-p 32765 -o 32766'''
 +
fi
 +
 
 +
To make the lock daemon listen on port '''32768''' only and set the nfs callback port to '''32764''' we need to create file '''/etc/sysctl.d/nfs.conf''' :
 +
 
 +
fs.nfs.nlm_udpport=32768
 +
fs.nfs.nlm_tcpport=32768
 +
fs.nfs.nfs_callback_tcpport=32764
 +
 
 +
Last BOOTP and the NFS ports must be added to '''/etc/rc.d/rc.firewall''' :
 +
 +
# BOOTP
 +
iptables -A INPUT -p udp -j ACCEPT --dport 69 -s 192.168.0.0/16
 +
 +
# NFS ports
 +
iptables -A INPUT -p udp -j ACCEPT --dport 111 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 111 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 2049 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 2049 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32764 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32764 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32765 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32765 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32766 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32766 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32767 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32767 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32768 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32768 -m state --state NEW -s 192.168.0.0/16
 +
iptables -A INPUT -p udp -j ACCEPT --dport 32769 -s 192.168.0.0/16
 +
iptables -A INPUT -p tcp -j ACCEPT --dport 32769 -m state --state NEW -s 192.168.0.0/16
 +
 
 +
== Slackware setup ==
 +
 
 +
A few pieces of advice to make your Slackware setup from network easier :
 +
 
 +
* For some reason Slackare might use an interface other than eth0. Just move the cable to the right slot or update (or remove) /etc/udev/rules.d/70-persistent-net.rules.
 +
 
 +
* Slackware network setup uses NFS version 3 meaning that directory paths are absolute.
 +
 
 +
* The FTP directory paths are instead relative to the ftp user home directory.
 +
 
 +
<br/>
 +
 
 +
{{pFoot|[[Managing partitions]]|[[Main Page]]|[[Installing Slackware]]}}

Revision as of 19:24, 24 January 2025

The (local) network is an additional choice to install Slackware from when your hardware has this capability. Installing from the local network is much faster than from a DVD and is a good choice when playing around with the installation. This page explains how to configure a Slackware server for this usage. It was inspired by the AlienBob's blog page on the same topic. To install Slackware over the network we need :

  • A service to download the Slackware files during the Slackware setup. HTTP, FTP, or NFS can be used. In the example below we show how to use the NFS and FTP services included with Slackware.
  • A service implementing the TFTP protocol. TFTP is used to effectively download the bootstrap code from the server identified. We will use the TFTP protocol included with Slackware.
  • A service implementing the BOOTP protocol. BOOTP is used by the PXE firmware to identify on the network a server to download the bootloader code from. The DHCP server included with the Slackware distribution has this capability.

Configuring NFS

NFS is SUN's Network File System. It is lightning fast and can be used as a mount point, but depending on configuration may be unsecure and must be used locally only. Also, it uses some random port numbers that need to be fixed if firewalling. The directories used are defined in /etc/exports. Edit as follows. ro means read-only, sync makes sure that no asynchronous requests are made, insecure affords using different NFS ports from other NFS implementations, all_squash maps all uids and gids to the anonymous user for public access, no_subtree_check improves reliability in some circumstances. See man exports for more details.

# See exports(5) for a description.
# This file contains a list of all directories exported to other computers.
# It is used by rpc.nfsd and rpc.mountd.

/var/pub       192.168.53.1/24(ro,sync,insecure,all_squash,no_subtree_check)

The NFS server is launched using /etc/rc.d/rc.nfsd. Make this script executable so as to use it on every boot. You can also start it to test it immediately. The NFS client is launched using /etc/rc.d/rc.rpc and affords using NFS mount points from other NFS servers. Make this script executable if you want to use it and have it started on every reboot. This can be handy to cross-test NFS machines. Otherwise it should not be necessary.

# chmod u+x /etc/rc.d/rc.nfsd
# chmod u+x /etc/rc.d/rc.rpc

Configuring FTP

As SSH affords encrypted authentication and transfers, FTP will be used on our site only for anonymous public downloads. FTP uses fixed port numbers so it is easy to firewall, but it is much slower than NFS. Slackware includes two FTPs : ProFTPd and vsFTP. We will use the latter. Using vsFTP requires very little configuration : setting the home directory of the ftp user to where we want our files to be downloaded from, uncommenting the correct ftp line in /etc/inetd.conf and /etc/rc.d/rc.inetd restart, updating the firewall rules. For more details man vsftpd.conf.

# usermod --home /var/pub ftp
. . . 
# Very Secure File Transfer Protocol (FTP) server.
ftp     stream  tcp     nowait  root    /usr/sbin/tcpd  vsftpd
. . .
# /etc/rc.d/rc.inetd restart
. . .
# services on local network FTP BOOTP HTTP NNTP IMAP HTTPS SUBMIT VNC VOIP
iptables -A INPUT -p tcp -j ACCEPT --dport 20 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 21 -m state --state NEW -s 192.168.0.0/16

Putting the Slackware install files online

Copy the content of the slackware DVD to a disk directory, for instance /var/pub/slackware64-15.0

# mkdir /mnt/dvd
# mkdir /var/pub/slackware64-15.0
# mount -o loop slackware64-15.0-install-dvd.iso /mnt/dvd
# cp -a /mnt/dvd/* /var/pub/slackware64-15.0/
# umount /mnt/dvd

During install, when asked for the source directory specify subdirectory slackware64 that is, /var/pub/slackware64-15.0/slackware64

The Slackware network setup uses NFS version 3 meaning that directory paths are absolute.

Configuring TFTPBOOT

TFTP is the trivial ftp protocol (for use on a local network). Let's create the tftp bootp file structure under the default /tftpboot directory. The directory where we store the bootloader files is /tftpboot/slackware64-15.0 :

# mkdir /tftpboot
# mkdir /tftpboot/slackware64-15.0
# mkdir /tftpboot/slackware64-15.0/pxelinux.cfg
# cp /usr/share/syslinux/pxelinux.0 /tftpboot/slackware64-15.0/
# cp /var/pub/slackware64-15.0/isolinux/message.txt /tftpboot/slackware64-15.0/
# cp /var/pub/slackware64-15.0/isolinux/f2.txt /tftpboot/slackware64-15.0/
# cp -a /var/pub/slackware64-15.0/kernels /tftpboot/slackware64-15.0/
# cp /var/pub/slackware64-15.0/usb-and-pxe-installers/pxelinux.cfg_default /tftpboot/slackware64-15.0/pxelinux.cfg/default
# cp /var/pub/slackware64-15.0/isolinux/initrd.img /tftpboot/slackware64-15.0/

Tftpboot is handled by inetd. To activate it, uncomment the tftp line in /etc/inetd.conf then /etc/rc.d/rc.inetd restart or reboot.

tftp  dgram   udp     wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize

Configuring DHCP

We configure /etc/dhcpd.conf as follows. Our subnet is 192.168.53.0, our network mask 255.255.255.0, our IP address is 192.168.53.1, our router address 192.168.53.254. The IP DHCP range is 192.168.53.154 to 192.168.53.253. For more details on other configuration possbilities, man dhcpd.conf.

# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
ddns-update-style none;

# Allow bootp requests
allow bootp;

# Point to the TFTP server:
next-server 192.168.53.1;

# Default lease is 1 week (604800 sec.)
default-lease-time 604800;
# Max lease is 4 weeks (2419200 sec.)
max-lease-time 2419200;

subnet 192.168.53.0 netmask 255.255.255.0 {
    option domain-name "studioware.com";
    option broadcast-address 192.168.53.255;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 192.168.53.1;
    option routers 192.168.53.254;
    range dynamic-bootp 192.168.53.154 192.168.53.253;
    use-host-decl-names on;
    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
      filename "/slackware64-15.0/pxelinux.0";
    }
}

Next is to create a script /etc/rc.d/rc.dhcpd to launch dhcp. Our bridged interface is br0 :

#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#      This shell script takes care of starting and stopping
#      the ISC DHCPD service
#

# Put the command line options here that you want to pass to dhcpd:
DHCPD_OPTIONS="-q br0"

[ -x /usr/sbin/dhcpd ] || exit 0

[ -f /etc/dhcpd.conf ] || exit 0

start() {
      # Start daemons.
      echo -n "Starting dhcpd:  /usr/sbin/dhcpd $DHCPD_OPTIONS "
      /usr/sbin/dhcpd $DHCPD_OPTIONS
      echo
}
stop() {
      # Stop daemons.
      echo -n "Shutting down dhcpd: "
      killall -TERM dhcpd
      echo
}
status() {
  PIDS=$(pidof dhcpd)
  if [ "$PIDS" == "" ]; then
    echo "dhcpd is not running!"
  else
    echo "dhcpd is running at pid(s) ${PIDS}."
  fi
}
restart() {
      stop
      start
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  status)
        status
        ;;
  *)
        echo "Usage: $0 {start|stop|status|restart}"
        ;;
esac

exit 0

Next is to make /etc/rc.d/rc.dhcpd executable, launch it from /etc/rc.d/rc.local and stop it from /etc/rc.d/rc.local_shutdown :

# chmod u+x rc.dhcpd
. . .
# start dhcpd
if [ -x /etc/rc.d/rc.dhcpd ]; then
        /etc/rc.d/rc.dhcpd start
fi
. . .
# stop dhcpd
if [ -x /etc/rc.d/rc.dhcpd ]; then
    /etc/rc.d/rc.dhcpd stop
fi

Firewalling NFS

Refer to IPTables for an introduction on packet filtering. NFS uses some random ports by defaults, that we need to fix if we want to be able to do proper packet filtering. To be precise, NFS uses sunrpc/111 and nfsd/2049, and random port numbers are used by other NFS daemons but it is possible to specify alternative port numbers on the command line or in the /etc/services file, to which we add :

rpc.nfs-cb      32764/tcp  # RPC nfs callback
rpc.nfs-cb      32764/udp  # RPC nfs callback
status          32765/udp  # NFS status (listen)
status          32765/tcp  # NFS status (listen)
status          32766/udp  # NFS status (send)
status          32766/tcp  # NFS status (send)
mountd          32767/udp  # NFS mountd
mountd          32767/tcp  # NFS mountd
lockd           32768/udp  # NFS lock daemon/manager
lockd           32768/tcp  # NFS lock daemon/manager
rquotad         32769/udp  # NFS rquotad
rquotad         32769/tcp  # NFS rquotad

The /etc/rc.d/rc.nfsd and /etc/rc.d/rc.rpc scripts are modified to specify port numbers on the command lines :

if [ -x /usr/sbin/rpc.rquotad ]; then
  echo "  /usr/sbin/rpc.rquotad -p 32769"
  /usr/sbin/rpc.rquotad -p 32769
fi

if [ -x /usr/sbin/rpc.mountd ]; then
  echo "  /usr/sbin/rpc.mountd -p 32767"
  /usr/sbin/rpc.mountd -p 32767
fi

if ! ps axc | grep -q rpc.statd ; then
  echo "Starting RPC NSM (Network Status Monitor):  /sbin/rpc.statd -p 32765 -o 32766"
  /sbin/rpc.statd -p 32765 -o 32766
fi

To make the lock daemon listen on port 32768 only and set the nfs callback port to 32764 we need to create file /etc/sysctl.d/nfs.conf :

fs.nfs.nlm_udpport=32768
fs.nfs.nlm_tcpport=32768
fs.nfs.nfs_callback_tcpport=32764

Last BOOTP and the NFS ports must be added to /etc/rc.d/rc.firewall :

# BOOTP
iptables -A INPUT -p udp -j ACCEPT --dport 69 -s 192.168.0.0/16

# NFS ports
iptables -A INPUT -p udp -j ACCEPT --dport 111 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 111 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 2049 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 2049 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32764 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32764 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32765 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32765 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32766 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32766 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32767 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32767 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32768 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32768 -m state --state NEW -s 192.168.0.0/16
iptables -A INPUT -p udp -j ACCEPT --dport 32769 -s 192.168.0.0/16
iptables -A INPUT -p tcp -j ACCEPT --dport 32769 -m state --state NEW -s 192.168.0.0/16

Slackware setup

A few pieces of advice to make your Slackware setup from network easier :

  • For some reason Slackare might use an interface other than eth0. Just move the cable to the right slot or update (or remove) /etc/udev/rules.d/70-persistent-net.rules.
  • Slackware network setup uses NFS version 3 meaning that directory paths are absolute.
  • The FTP directory paths are instead relative to the ftp user home directory.


Managing partitions Main Page Installing Slackware