Version 4 vs 32
Version 4 vs 32
Content Changes
Content Changes
# Multicast
## Steps
* Step 1: Manually Clone a machine in the lab this will act as the server in the multicast
* Step 1.1: dd the mbr to /tmp/mbr.bin
```
dd if=/dev/sda of=/tmp/mbr.bin bs=512 count=1
```
* Step 2: Netboot the entire lab
* Step 3: Connect to **steamboat.engr.unr.edu** using you netid
* Step 4: On **steamboat** use ansible to connect to all of them
```
cd /srv/ansible/
source python_env/bin/activate
ansible -i /etc/hosts -m shell -a "hostname"
```
IMPORTANT: Check that all the hosts you want clone responded and no others.
* Step 5: using ansible run subscriber script
```
nohup sh /images/multi/udp-receiver-sda.sh &
```
* Step 6: Run the sender script on the machine acting as the server and hit key
to start sending the script is located in /images/multi
```
sh udp-sender-sda.sh
```
* Step 7: Hit key on server to start sending data
# Multicast
## Steps
Step 1: **Manually** [[ https://ph.engr.unr.edu/w/ecc/cloning/ | clone ]] a machine in the lab. This will act as the master.
Step 2: Netboot the entire lab
Step 3: Connect to **steamboat.engr.unr.edu** using your netid
```lang=bash
# ssh netID@steamboat.engr.unr.edu
$ ssh igrant@steamboat.engr.unr.edu
```
Step 4: On **steamboat**, source into your environment to use ansible.
```
$ source /srv/ansible/python_env/bin/activate
```
IMPORTANT: Check that all the hosts you want to clone have responded and no others.
Step 5: To check all hosts, run `ansible -i /etc/ansible/hosts -m "shell" -a "hostname" LAB_LETTER `.
```lang=bash
# ansible -i /etc/ansible/hosts -m "shell" -a "hostname" lab_letter
$ ansible -i /etc/ansible/hosts -m "shell" -a "hostname" lab_d
```
---
IMPORTANT: If you would like to build a custom hosts file, for example targeting only some hosts in a lab, netboot the hosts you would like to target, then use nmap to scan the desired subnet to get the IPs of the corresponding target machines.
```lang=bash
nmap -p 22 172.20.195.0/24 -oN output.txt
```
Then you can grab the IPs by grepping the output of the nmap scan for machines with ssh open.
```lang=bash
grep -B 3 "22/tcp open" output.txt | awk '{print $5} | grep "[0-9]\{1,3\}\.[0-9]\{1,3\}\.'" > newHosts.txt
```
Edit the **newHosts.txt** file such that it resembles this sample.
```lang=bash
[<label>]
LIST_OF_IPS
[<label>:vars]
ansible_ssh_private_key_file=/srv/ansible/.ssh/coen-ansible
```
Once this is complete you can now target your newHosts.txt when specifying the path for the **-i** flag.
---
Step 6: On your steamboat connecting while using ansible, run the subscriber script `nohup sh /netboot/images/multi/udp-receiver-sda.sh &`
```lang=bash
# ansible -i /etc/ansible/hosts -m "shell" -a "nohup sh /netboot/images/multicast/udp-receiver-sda.sh &" lab_x
$ ansible -i /etc/ansible/hosts -m "shell" -a "nohup sh /netboot/images/multicast/udp-receiver-sda.sh &" lab_c
```
Step 7: Run the sender script on the master and hit key to start sending the script is located in `/netboot/images/multicast`
```
$ cd /netboot/images/multicast
**Run this in /tmp or anywhere else that's not in the root directory since / is read-only.
$ ./udp-sender-sda.sh
```
Step 8: Hit the `ANY` key on server to start sending data.
Step 9: Be sure to go around and join the computers to the domain and activate labview.
---
(NOTE) Have the **[[ https://ecc-pxe.engr.unr.edu:8443/ipxe/dashboard | dashboard ]]** up to check your progress along the way.
Step 9: When you're done, be sure to rename the machine, join to the domain, and activate labview by connecting to tinkerbell using the identity file.
```lang=bash
# make sure that you are still on steamboat
$ sudo ssh root@tinkerbell.engr.unr.edu -i /srv/ansible/.ssh/coen-ansible
```
Step 10: Source into the IMM Environment
```lang=bash
$ source /opt/imm-env/bin/activate
```
Step 11: Head over to `/opt/imm`
```lang=bash
$ cd /opt/imm
```
Step 12: Here, you should see the `winrm_tasks.py` file. Below is a list of tasks that you can run:
```lang=bash
# /opt/imm/tasks
check_status
check_status_ip
hostnames
change_hostname
reboot
domain_join
activate_labview
default_printer
printer
shutdown
```
Rather than going around and joining everything to the domain manually, you can run some winrm scripts to do the job.
To execute, type `./winrm_tasks.py --filter ECC-LAB- TASKS`.
```lang=bash
# ./winrm_tasks.py --filter ecc-lab- task
$ ./winrm_tasks.py --filter ecc-a- check_status
```
IMPORTANT: If the entire lab had just been cloned, run the tasks below in the same order. Also, before completing the printer tasks, edit the file by typing `nano /tasks/printer.py` and change the default printer to the respective lab.
```lang=bash
check_status
change_hostname
hostnames
domain_join
activate_labview
printer
check_status
```
# Multicast
## Steps
Step 1: **Manually** [[ https://ph.engr.unr.edu/w/ecc/cloning/ | clone ]] a machine in the lab. This will act as the master.
Step 2: Netboot the entire lab
Step 3: Connect to **steamboat.engr.unr.edu** using your netid
```lang=bash
# ssh netID@steamboat.engr.unr.edu
$ ssh igrant@steamboat.engr.unr.edu
```
Step 4: On **steamboat**, source into your environment to use ansible.
```
$ source /srv/ansible/python_env/bin/activate
```
IMPORTANT: Check that all the hosts you want to clone have responded and no others.
* Step 1: Manually Clone a machine in the lab this will act as the server in the multicast5: To check all hosts, run `ansible -i /etc/ansible/hosts -m "shell" -a "hostname" LAB_LETTER `.
```lang=bash
* Step 1.1: dd the mbr to /tmp/mbr.bin# ansible -i /etc/ansible/hosts -m "shell" -a "hostname" lab_letter
$ ansible -i /etc/ansible/hosts -m "shell" -a "hostname" lab_d
```
---
IMPORTANT: If you would like to build a custom hosts file, for example targeting only some hosts in a lab, netboot the hosts you would like to target, then use nmap to scan the desired subnet to get the IPs of the corresponding target machines.
```lang=bash
nmap -p 22 172.20.195.0/24 -oN output.txt
```
Then you can grab the IPs by grepping the output of the nmap scan for machines with ssh open.
```lang=bash
dd if=/dev/sda of=/tmp/mbr.bin bs=512 count=1grep -B 3 "22/tcp open" output.txt | awk '{print $5} | grep "[0-9]\{1,3\}\.[0-9]\{1,3\}\.'" > newHosts.txt
```
Edit the **newHosts.txt** file such that it resembles this sample.
```lang=bash
* Step 2: Netboot the entire lab[<label>]
* Step 3: Connect to **steamboat.engr.unr.edu** using you netidLIST_OF_IPS
[<label>:vars]
* Step 4: On **steamboat** use ansible_ssh_private_key_file=/srv/ansible to connect to all of them/.ssh/coen-ansible
```
Once this is complete you can now target your newHosts.txt when specifying the path for the **-i** flag.
---
Step 6: On your steamboat connecting while using ansible, run the subscriber script `nohup sh /netboot/images/multi/udp-receiver-sda.sh &`
cd /srv/ansible/```lang=bash
source python_env/bin/activate# ansible -i /etc/ansible/hosts -m "shell" -a "nohup sh /netboot/images/multicast/udp-receiver-sda.sh &" lab_x
$ ansible -i /etc/ansible/hosts -m "shell" -a "hostname"nohup sh /netboot/images/multicast/udp-receiver-sda.sh &" lab_c
```
IMPORTANT: Check that all the hosts you want clone responded and no others.
* Step 5: using ansible run subscriber scriptStep 7: Run the sender script on the master and hit key to start sending the script is located in `/netboot/images/multicast`
```
$ cd /netboot/images/multicast
**Run this in /tmp or anywhere else that's not in the root directory since / is read-only.
$ ./udp-sender-sda.sh
```
Step 8: Hit the `ANY` key on server to start sending data.
Step 9: Be sure to go around and join the computers to the domain and activate labview.
---
(NOTE) Have the **[[ https://ecc-pxe.engr.unr.edu:8443/ipxe/dashboard | dashboard ]]** up to check your progress along the way.
Step 9: When you're done, be sure to rename the machine, join to the domain, and activate labview by connecting to tinkerbell using the identity file.
```lang=bash
# make sure that you are still on steamboat
$ sudo ssh root@tinkerbell.engr.unr.edu -i /srv/ansible/.ssh/coen-ansible
```
Step 10: Source into the IMM Environment
```lang=bash
$ source /opt/imm-env/bin/activate
```
nohup sh /images/multi/udp-receiver-sda.sh &Step 11: Head over to `/opt/imm`
```lang=bash
$ cd /opt/imm
```
* Step 6: Run the sender script on the machine acting as the server and hit key12: Here, you should see the `winrm_tasks.py` file. Below is a list of tasks that you can run:
to start sending the script is located in /images/multi```lang=bash
# /opt/imm/tasks
check_status
check_status_ip
hostnames
change_hostname
reboot
domain_join
activate_labview
default_printer
printer
shutdown
```
sh udp-sender-sda.shRather than going around and joining everything to the domain manually, you can run some winrm scripts to do the job.
To execute, type `./winrm_tasks.py --filter ECC-LAB- TASKS`.
```lang=bash
# ./winrm_tasks.py --filter ecc-lab- task
$ ./winrm_tasks.py --filter ecc-a- check_status
```
IMPORTANT: If the entire lab had just been cloned, run the tasks below in the same order. Also, before completing the printer tasks, edit the file by typing `nano /tasks/printer.py` and change the default printer to the respective lab.
```lang=bash
check_status
* Step 7: Hit key on server to start sending datachange_hostname
hostnames
domain_join
activate_labview
printer
check_status
```