Syncthing – A way to share files on multiple computers.

So at our store’s we use dropbox for most of our files, however there are some files which have proven to be difficult to put into dropbox folders. For instance sometimes we need to share 60-100GB of files between the computers, and if you push them through dropbox it will take over a day at times to transfer the files.

So in my research I found syncthing, which allows you to sync folders between multiple computers and seems to be much faster than dropbox. It does take a little extra effort to set up but once it is it does seem to sync fairly quickly.

You can find out more information on syncthing by going to Syncthing

Fog PXE Linux Distros Configurations

So when I started to populate my Fog server with pxe boot images I when on the guidelines of this posting. Some of the images now are a little out of date so I decided that I’d update them so that if anyone is trying to rebuild a fog server maybe I can help you out. Now keep in mind these setups were done with a regular bios install in mind. My vmware servers are older and I do not have the ability to test uefi. So maybe it will work, and maybe it won’t.

First off like the post do

mkdir /mnt/loop

In most of the images I installed there are a couple of commands that get done over and over

mkdir /images/os/{insert your distro}/{insert version}
mkdir /tftpboot/os/{insert your distro}/{insert version}
mount -o loop -t iso9660 /{full path where you have the iso stored}/{thedistro}.iso /mnt/loop
cp -R /mnt/loop/* /images/os/{distro}/{version}

In some cases we do have to copy a vmlinz & a initrd to the /tftp/os/ folder for that distro.

umount /mnt/loop

Again in almost all the cases here’s how it goes as an example.

First I’d get the distro. For the example let’s say Ubuntu 18.04

I’d do.

wget {url of distro}

then I would do

mkdir /images/os/ubuntu/18.04

then I would do

mkdir /tftp/os/ubuntu/18.04

Then I would do

mount -o loop -t iso9660 ubuntu18.04.iso /mnt/loop

Then copy the files from the iso

cp -R /mnt/loop/* /images/os/ubuntu/18.04

then un mount the iso

umount /mnt/loop

For all of the distros that I will mention this will be the same cycle for every one.

What does change is the vmlinuz and initrd file because they are different names. In my setups I’ve used the places there I have put the files.

So here we go.

Centos 7

cp /images/os/centos/7/vmlinuz /tftpboot/os/centos/7/
cp /images/os/centos/7/initrd.img /tftpboot/os/centos/7/

Menu Item: os.Centos7

Description: Centos 7

Parameters:

kernel tftp://${fog-ip}/os/centos/7/vmlinuz
initrd tftp://${fog-ip}/os/centos/7/initrd.img
imgargs vmlinuz initrd=initrd.img root=live:nfs://${fog-ip}/images/os/centos/7/LiveOS/squashfs.img ip=dhcp repo=nfs://${fog-ip}/images/os/centos/7 splash quiet
boot || goto MENU

Debian 9.5

With debian you need to get and mount the net installer version of debian and extract the linux and initrd.gz files from the installer and copy them both to the /os/debian/9.5/ directory

Menu Item: os.Debian9.5

Description: Debian 9.5

Parameters:

kernel tftp://${fog-ip}/os/debian/9.5/linux
initrd tftp://${fog-ip}/os/debian/9.5/initrd.gz
imgargs linux initrd=initrd.gz root=/dev/nfs netboot=nfs nfsroot=${fog-ip}:/images/os/debian/9.5/ ip=dhcp rw
boot || goto MENU

Fedora 28

cp /images/os/fedora/W28/isolinux/vmlinuz /tftpboot/os/fedora/W28/
cp /images/os/fedora/W28/isolinux/initrd.img /tftpboot/os/fedora/W28/

Menu Item: osFedoraW28

Description: Fedora Workstation v28

Parameters:

kernel tftp://${fog-ip}/os/fedora/W28/vmlinuz
initrd tftp://${fog-ip}/os/fedora/W28/initrd.img
imgargs vmlinuz initrd=initrd.img root=live:nfs://${fog-ip}/images/os/fedora/W28/LiveOS/squashfs.img ip=dhcp repo=nfs://${fog-ip}/images/os/fedora/W28
boot || goto MENU

OpenSuSE Leap 15

Same as Debian you need to download the netboot version of the iso and mount it then copy the linux and initrd files to the /os/opensuse/leap15 folder

Menu Item: os.OpenSuSE.15

Decription: OpenSuSE Leap 15

Parameters:

kernel tftp://${fog-ip}/os/opensuse/leap15/linux
initrd tftp://${fog-ip}/os/opensuse/leap15/initrd
imgargs linux initrd=initrd ip=dhcp repo=nfs://${fog-ip}:/images/os/opensuse/leap15/
boot || goto MENU

Ubuntu Based Distros

Before 18.04 the best instructions were from the fog forum at this post.

With 18.04 they changed something. So I will simplify things again the process works the same for ubuntu desktop, Server, Linux mint, and I’m assuming the rest, but haven’t tested every variant of 18.04

cp /images/ubuntu/casper/vmlinuz /tftpboot/os/ubuntu/version/
cp /images/os/ubuntu/casper/isolinux/initrd.lz /tftpboot/os/ubuntu/version/

Menu Item: os.Ubuntu.Version

Description: Ubuntu Version

Parameters

kernel tftp://${fog-ip}/os/ubuntu/Desktop18.04/vmlinuz
initrd tftp://${fog-ip}/os/ubuntu/Desktop18.04/initrd.lz
imgargs vmlinuz root=/dev/nfs boot=casper netboot=nfs nfsroot=${fog-ip}:/images/os/ubuntu/Desktop18.04/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us quiet splash toram ip=dhcp rw
boot || goto MENU

They key with the 18.04 releases appears to be toram

Having a dead simple PXE Server

So my big project the last week or so was coming up with a pxe server to boot images from the network.

My first reason is that I keep my images on another server and when I’ve attached them with vmware if I accidentally close VMware workstation there goes my install.

Secondly I have two machines that seem to be real picky on usb sticks to boot from. Not sure what the issue is but they just stop at some point.

Plus it would be great to not have to deal with usb keys.

So at first I tried building the pxe server myself. I got a couple images in fine, but at some point I’d always get stuck. Spent alot of time looking at installs that were based on other linux distros, as well as the instructions on how to put older versions of ubuntu, centos, etc onto the pxe server. So it just made it a total pain.

That is until I decided to load up the Fog Project. It’s software that you can install on linux distros like debian and centos and it makes it real easy to set up a pxe server. It does have a few other features, which I have not gotten into yet, but probably will.

The best thing really is that it makes it easy to set up the pxe server, you still have to deal with setting up the distros, but it’s no where near as bad.

In the next couple of days I hope to have instructions on how to install recent distros onto the fog server.

Logging into VMware ESXi after vcenter goes down

So I have 2 VMWare ESXi hosts that were recently connected to a vcenter vsphere for testing purposes. When I did the original setup I installed the vcenter on server 1 and thought I had set it up to boot automatically on system startup.

Well I did some maintenance on the server and lo and behold nope. So long story short I found myself unable to log into the server to start up the vcenter because it was looking for the vcenter for the credentials.

After an initial panic I took a few minutes to figure out the answer.

So if for some reason you get locked out of a esxi host you want to go to the machine and hit f2 enter the local user and password and then look for configure lockdown mode. Disable that and you should be able to log into the esxi machine as a local account once again so you can start up the virtual machine. And like I immediately did make sure you turn on autostart 🙂

Adding PXE server into a Unifi Security Gateway

So I’m in the process of setting up a PXE Server on my network. I have a Debian based TFTP server that I created without DHCP setup on it. Mainly because I want the USG to do most of the work.

So of course I went looking around the web to do this first. Which I really couldn’t find anything on how to do it, which of course lead me to an important lesson. Always look through the settings first. 🙂

So here’s what you need to do.

  • Log into your Unifi system
  • Then click network
  • Then click edit for the lan you want the pxe server to be on
  • Then click advanced DHCP options.

  • Click enable network boot. Enter the ip of the server as well as the file it will be booting. In my case currently I have just one linux distro in there.
  • Under DHCP TFTP Server put in the ip address of the PXE server as well.

And then you should be good to go provided you set up your PXE Server correctly.

Microsoft Windows & Office ISO Download tool

While I have most of the ISOs of windows versions there are times where I need to get another copy. Maybe it’s got a corrupt version, or I need a weird version of windows etc.

So this tool is one of the important ones I use to get an ISO file

It’s called the Windows and Office ISO Download tool. And it can be downloaded here.

It’s works nice and allows you get get a wide range of ISOs from Microsoft.

Script to keep Hamachi alive

We use hamachi by logmein at work for various things, but one of the problems with hamachi at times is sometimes the tunneling engine doesn’t start. Now previously I had created a batch file that did this job, but it was pieced together with code I found online. So overall it was complicated.

So I wanted to redo it in powershell as well  make it give some kind of message in case someone else was needing to run this script.

So here it is

while ($true) {

if (-not (Test-Connection '192.168.0.207' -Quiet)) {

Write-Host "Test failed: $(Get-Date -Format "MM/dd hh:mm tt")"

Write-Host "Restarting Hamachi..." -ForegroundColor Red

Restart-Service Hamachi2Svc
Start-Sleep -Seconds 60

}

else {

Write-Host "Connection test passed: $(Get-Date -Format "MM/dd hh:mm tt")"

Start-Sleep -Seconds 600

}

}

It does need to be ran as an admin and I’ve got it set up as scheduled task for when the computer reboots.

The line that says

Start-Sleep -Seconds 60

is how long it will wait for hamachi to restart before it tries again. In my case it seems 60 seconds is plenty of time, but you may want to bump the time up a bit if needed.

Run a powershell script in task scheduler without it poping up.

I run some powershell scripts at work to keep things running and do things automatically. Problem when you put them in a task scheduler they pop up on the screen when they run.

So here’s what I found that works to keep them from showing up.

Open up the properties of a scheduled task

in the program/script section put

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

for arguments  put in

-File "C:\folder_of_script\script.ps1"

for start in put

c:\folder_of_scripts\

And that’s all there is to it.

To login automatically in windows 10

I had some computers that need to automatically login. Most are because they’re doing something. Running security systems, or virtual machines that really don’t need to be logged out.

So here’s all you need to do to make windows 10 log into a user automatically.

First hit the windows key and then type

netplwiz

and click that program.

It will come to a window that looks like this.

You want to uncheck the box that I circled above on the user you want to login.

Then it will take you to a page where you enter your password.

And that’s it.

Debloating Windows 10 the easy way

I found this website on GitHub. Windows10Debloater

I particular there’s one script in particular on the main page.

At the time of this posting it is called Windows10Debloater.ps1

Used it on some of my machines. While it wasn’t able to remove everything I will say 90% of the bloat is removed and you just have to uninstall a couple other apps.

I do suggest checking the page out before running the code as I have noticed things change and as of this writing this script was updated 9 days before.