How to setup ssh

1. Generate needed ssh key

mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -b 4096 -C "<user>@<host> server key" -f ~/.ssh/<user>_<host>.key

2. Install ssh key on ssh server

ssh-copy-id -i ~/.ssh/<user>_<host>.key <user>@<host>

3. Create ~/.ssh/config file

cat >> ~/.ssh/config <<EOL
Host *
    ServerAliveInterval 15
    ServerAliveCountMax 6
    Compression yes

Host <host>
    HostName <host-fqdn>
    Port 22
    User <user>
    IdentityFile ~/.ssh/<user>_<host>.key
    IdentitiesOnly yes
    ForwardAgent yes
    # this sets up a socks5 proxy
    DynamicForward localhost:1080
    # this sets up a local port to forward traffic to a remote host and port
    LocalForward 8080 <some-remote-host-fqdn>:80

# this sets up a remote git server accessible by ssh proxy above
#Host <remote-git-server>
#    HostName <remote-git-server>
#    ProxyCommand ssh <host> -W %h:%p
#    IdentityFile ~/.ssh/<remote-git-server>.key
#    User <remote-git-server-user>
EOL
chmod 600 ~/.ssh/*

How to install proxychains

sudo apt install proxychains
cp /etc/proxychains.conf ~/
echo 'socks5 127.0.0.1 1080' >> ~/proxychains.conf
sudo mv ~/proxychains.conf /etc/proxychains.conf

# to run ui project off-site
proxychains npm start

How to install polipo

sudo apt install -y polipo

mkdir -p ~/.config/polipo
cp /etc/polipo/config ~/.config/polipo/
echo "socksParentProxy = \"127.0.0.1:1080\"" >> ~/.config/polipo/config
echo "socksProxyType = socks5" >> ~/.config/polipo/config
echo "proxyAddress = \"::0\"" >> ~/.config/polipo/config
echo "proxyPort = 8123" >> ~/.config/polipo/config

sudo mv ~/.config/polipo/config /etc/polipo/config
rmdir ~/.config/polipo
sudo service polipo restart

Esxi to Hyper-V Migration

So over this past week I decided it was time to switch from user esxi to user hyper-v.

My setup:

  • Physical Server
    • HP Proliant ML310e G8
  • Virtual Machines
    • domain controller
    • remote gateway
    • team foundation server
    • certificate authority
    • windows 7
    • windows xp
    • file share
    • sql server
    • iis

Unfortunately I only have one server so the easy migration path of Virtual Machine Manager wasn’t going to work.  So here is what I did to make things work:

  1. Download Microsoft Virtual Machine Converter (http://www.microsoft.com/en-us/download/details.aspx?id=34591)
  2. Download Hyper-V Server 2012R2 (http://technet.microsoft.com/en-us/evalcenter/dn205299.aspx)
  3. Download hvremote.wsf (http://code.msdn.microsoft.com/windowsdesktop/Hyper-V-Remote-Management-26d127c6)
  4. Burn Hyper-V iso to a disc
  5. Copy hvremote.wsf to a flash drive
  6. Add Hyper-V Manager feature to workstation
  7. Install Microsoft Virtual Machine Converter
  8. Document the number of nics, cpus and ram for each virtual machine.
  9. Now because I am running a domain and the domain controller is a virtual machine
    1. Either remove a physical machine from the domain (I chose this option as I didn’t have another physical machine to run the domain controller on)
    2. Or find a way to make the domain controller network accessible during the migration
  10. Power down all the virtual machines.
  11. Copy the virtual machines from the esxi datastore using vshpere client to another disk that is windows friendly formatted.
  12. Shutdown esxi host.
  13. Run Provision soft during host start up and provision as windows server with manual setup of OS.
  14. Install Hyper-V
  15. Setup static ip networking for hyper-v host
  16. Enable remote desktop connections
  17. Check for Windows updates
  18. Go to the cmd window
  19. Navigate to the location of the hvremote.wsf script
  20. Follow the guide on http://code.msdn.microsoft.com/windowsdesktop/Hyper-V-Remote-Management-26d127c6 for your setup.
  21. From windows 8 or higher enable the Hyper-V Management Tools under Hyper-V
  22. Run Hyper-V Management Tools and try to connect to  your server.
  23. Start creating new VMs based on saved info from #8 attaching the converted disks.

Links

  • hvremote.wsf – http://code.msdn.microsoft.com/windowsdesktop/Hyper-V-Remote-Management-26d127c6
  • Hyper-V – http://technet.microsoft.com/en-us/evalcenter/dn205299.aspx
  • vmdk to vhd – http://ittechlog.wordpress.com/2012/09/11/converting-a-vmdk-to-vhd-with-microsoft-virtual-machine-converter-mvmc/
  • vmdk to vhd – http://gabrielbeaver.me/2012/09/migrate-from-vmware-vms-to-hyper-v-windows-8/
  • Hyper-V setup – http://gabrielbeaver.me/2012/09/hyper-v-on-windows-8/