How to make a portable repair server

    A portable repair server is a home router for booting computers over a network for repair, restoration, inspection, and treatment. This server has the following advantages over a bootable USB flash drive:
    • stuck in a network and it is not necessary on each system unit to look for an unbroken USB connector;
    • Do not run the risk of burning a flash drive on shorted contacts;
    • the only way to boot on computers where the USB controller is burned (boot from the CD-ROM is not taken into account), as well as on computers where the BIOS does not allow loading from USB devices;
    • the desired way for flashing firmware.

    Among the shortcomings, one can note a lower transmission speed and some complexity in changing (supplementing) boot points, which affects the features of network loading. As a bonus, you can equip the repair server with your own Internet connection via a USB modem, this is required to isolate a virus-infected computer from other computers on the local network. So we need a router:
    1. with the possibility of flashing OpenWrt ;
    2. with a USB connector;
    3. compact sizes.

    The last item allows you to easily transfer the repair server to where it is more convenient for us to work with it, and not where there is a network, etc. As we already said, as a bonus you will need a USB hub, a USB flash drive and a USB modem with a working SIM card. Strange as it may seem, the choice of a modem is a difficult task, so there is no one hundred percent certainty in accordance with paragraph 1, so do not advertise for the sake of advising TP-Link TL-MR3020 (just do not take very similar models TP-Link TL-WR700N and TP-Link TL-WR702N) or the more expensive TP-Link TL-MR3040 with a built-in battery. Before buying, pay attention to the device version, supported versions can be found here .

    I will not replace the official OpenWrt documentation, so go to the page of the device you purchased and read the installation procedure for OpenWrt, as a rule, it is enough to download the firmware of your model and update (install) the downloaded file via the web interface. Perhaps, after flashing and subsequent rebooting the router, the web interface will be missing, you should not panic, download Putty and work through the console. One very important point - before further work, configure Internet access. First, we will transfer the system to a flash drive (extroot), and then we will install all the packages we need to work.

    The transfer process is well described in the documentation and there is an article on the subject. From myself I can recommend the following:
    • use the / overlay option;
    • use the ext2 file system (opkg install kmod-fs-ext4);
    • Keep in mind that the article implies the use of an already marked flash drive.

    If you don’t have the opportunity to partition the flash drive in advance (swapping no more than 128MB, the rest under the root partition), then you will need to install the following packages: fdisk, e2fsprogs and swap-utils, the article describes how to do this. And we will go further - now you can install all the packages that you wish. If you need a web interface, then you are here , and we will set up the Samba server so that it is convenient to upload files to the server using the standard Microsoft File and Printer Access service. First, open the required ports in the firewall, if the default rule for access via the network is set to "Drop". To do this, the following section should be in the / etc / config / firewall file:
    config 'rule'
            option 'src' 'lan'
            option 'proto' 'udp'
            option 'dest_port' '137-138'
            option 'target' 'ACCEPT'
    config 'rule'
            option 'src' 'lan'
            option 'proto' 'tcp'
            option 'dest_port' '139'
            option 'target' 'ACCEPT'
    config 'rule'
            option 'src' 'lan'
            option 'proto' 'tcp'
            option 'dest_port' '445'
            option 'target' 'ACCEPT'
    

    For more information on configuring the firewall, see here . Next, let's see what version of samba is available in the repository:
    opkg list | grep samba
    Install the package whose name you just got. More detailed information on working with packages is here . If you want to manage the Samba server via the web interface, install the appropriate module:
    opkg install luci-app-samba
    Some explanations should be given. First, instead of accessing at the user level, it’s better to switch to the resource level, which roughly corresponds to the simple file sharing in Windows XP. Secondly, the configuration file is created every time the router boots, so it’s better to edit the template/etc/samba/smb.conf.template. In our case, we need to replace the user value of the security parameter with the share value. Consider an example in which a directory exists /mnt/pxeboot(yes, I agree, the / mnt folder is used to mount devices, partitions, etc., but in openwrt it is the best directory for a network resource), if there is no such directory, create it with the command:
    mkdir -p /mnt/pxeboot
    C in order to comply with security measures, guest access occurs on behalf of the nobody user, therefore we need to make the nobody user the pxeboot folder owner:
    chown nobody /mnt/pxeboot
    Now, we write the sambashare section in the file etc/config/samba:
    ...
    config 'sambashare'
    	option 'read_only' 'no'
    	option 'name' 'share'
    	option 'path' '/ mnt / pxeboot'
    	option 'guest_ok' 'yes'
    

    We turn on and start the service with the commands:
    /etc/init.d/samba enable
    /etc/init.d/samba start
    

    Samba configuration is described in more detail in the documentation . Now we can upload files and directories from another computer, so in the network share we will create the tftpd folder, and in it a subdirectory: pxelinux.cfg (menu settings), img (disk images), boot and source (to download WinPE, see the previous article ) . Pour the necessary files for pxelinux into the tftpd directory, a list and description of which are given in the previous article .

    And so we got to setting up the boot menu, but before setting up, we need to decide on the composition of this boot menu, and here there will be as many opinions as there will be people involved in the dispute. And the argument will be pointless, as one person needs one set of tools, another - another. Let's take an abstract example, which will be:
    • local download;
    • WinPE boot
    • a submenu of utilities for the hard drive;
    • Memtest86.

    In fact, we get two files: default and hdd.cfg, with the latter we give only two points and a return point to the main menu. And one practical note: do not push everything into the WinPE image, just one file manager is enough, all other tools can be obtained over the network. If the size of the flash drive allows, then in the / mnt / pxeboot directory, create subfolders:
    • tools (windows utilities);
    • install (distributions);
    • wim (wim images for deploying various versions of Windows).

    The default file will look like this:
    UI vesamenu.c32
    MENU TITLE Portable PXE-boot server
    LABEL bootlocal
       MENU LABEL ^ Boot local disk
       MENU DEFAULT
       LOCALBOOT 0
     TIMEOUT 80
     TOTALTIMEOUT 9000
    LABEL winpe
       MENU LABEL ^ WinPE
       KERNEL pxeboot.0
    LABEL hddtools
      MENU LABEL hdd-tools
      KERNEL vesamenu.c32
      APPEND pxelinux.cfg / hdd.cfg
    LABEL memtest
      MENU LABEL Memtest86 6.0
      KERNEL memdisk
      APPEND iso initrd = img / memtest.iso
    

    I remind you once again that this is just an example, respectively, the hdd.cfg file:
    UI vesamenu.c32
    MENU TITLE Hard drive disk tools
    LABEL vcr350
      MENU LABEL Victoria 3.5
      KERNEL memdisk
      APPEND img initrd = img / fdd3.52.img
    LABEL Seagate7200.12
      MENU LABEL Firmware Seagate Barracuda 7200.12
      KERNEL memdisk
      APPEND iso initrd = img / barracuda12.iso
    LABEL return
      MENU LABEL Return Main Menu
      KERNEL vesamenu.c32
      APPEND pxelinux.cfg / default
    

    Make sure that all files are downloaded and in place. Now you can configure dnsmasq - a convenient dns-dhcp-tftpd server, the configuration file, which is / etc / config / dhcp:
    config dnsmasq
             ... 
            option enable_tftp '1'
            option tftp_root '/ mnt / pxeboot / tftpd'
            ... 
    config boot linux
            option filename 'pxelinux.0'
    ...

    That is, only three parameters are set. Now we can check all the settings. Great if everything works for you the first time. And what if something does not work? Of course, watch the system log. Most Windows users are unaware that Linux is case sensitive, so boot and boot are different folders. For example, just two folders will be required to boot WinPE: boot and Boot. Boot will contain the Fonts directory and the BCD file (exactly as indicated here), and the boot.sdi file will be in the boot directory. Pay attention to the extension register, for example, if the fdd3.52.img file is specified in the configuration file, and you download the fdd3.52.IMG file, then most likely you will get an error.

    Antiviruses are a special case, since they also need to download a huge antivirus database. Usually, they use two ways here: either load and mount the databases through the web server, or push them into the initrd file, as, for example, described here . But this is a topic for another article.

    Also popular now: