wget http://engshare.rutgers.edu/KVM/final2013.tgz tar -zxvf final2013.tgz cp final2013.xml /etc/libvirt/qemu cp final2013.img /home/hostadm/KVM virsh define /etc/libvirt/qemu/final2013.xml virsh start final2013 |
netstat -n --inet --listening --programs |
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 748/inetd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 631/sshd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 765/mysqld tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 599/rpcbind udp 0 0 0.0.0.0:769 0.0.0.0:* 599/rpcbind udp 0 0 0.0.0.0:68 0.0.0.0:* 580/dhclient3 udp 0 0 0.0.0.0:69 0.0.0.0:* 748/inetd udp 0 0 0.0.0.0:111 0.0.0.0:* 599/rpcbind |
grep 21 /etc/services grep 22 /etc/services grep 3306 /etc/services grep 111 /etc/services grep 769 /etc/services grep 68 /etc/services grep 69 /etc/services |
lsof -i TCP lsof -i UDP |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME rpcbind 599 root 8u IPv4 6808 0t0 TCP *:sunrpc (LISTEN) rpcbind 599 root 11u IPv6 6811 0t0 TCP *:sunrpc (LISTEN) sshd 631 root 3r IPv4 7338 0t0 TCP *:ssh (LISTEN) sshd 631 root 4u IPv6 7340 0t0 TCP *:ssh (LISTEN) inetd 748 root 4u IPv4 7519 0t0 TCP *:ftp (LISTEN) mysqld 765 mysql 10u IPv4 7750 0t0 TCP *:mysql (LISTEN) |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dhclient3 580 root 7u IPv4 6523 0t0 UDP *:bootpc rpcbind 599 root 6u IPv4 6806 0t0 UDP *:sunrpc rpcbind 599 root 7u IPv4 6807 0t0 UDP *:769 rpcbind 599 root 9u IPv6 6809 0t0 UDP *:sunrpc rpcbind 599 root 10u IPv6 6810 0t0 UDP *:769 inetd 748 root 5u IPv4 7521 0t0 UDP *:tftp |
grep final2013 /var/lib/libvirt/dnsmasq/default.leases |
nmap -sT 192.168.122.42 |
PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 111/tcp open rpcbind 3306/tcp open mysql |
#!/bin/bash IPT="/sbin/iptables" $IPT -F FORWARD $IPT -F INPUT $IPT -F OUTPUT $IPT -P FORWARD DROP $IPT -P INPUT DROP $IPT -P OUTPUT ACCEPT $IPT -A INPUT -m state -p tcp --dport 1024:65535 --state ESTABLISHED,RELATED -s 192.168.122.0/24 -j ACCEPT |
$IPT -A INPUT -p tcp --dport 22 -j ACCEPT |
$IPT -A INPUT -s 192.168.122.1 -j ACCEPT |
wget http://linuxcourse.rutgers.edu/Final_2013/scalar.c gcc scalar.c ./a.out |
gcc -fopenmp scalar.c export OMP_NUM_THREADS=2 ./a.out |
#pragma omp parallel for shared (z) private (i) for (i=0; i < n; i++) #pragma omp critical z += a[i]*b[i]; |