VNC_to_viterbi-scfN_via_SSH_Tunnel_Windows.docx

Introduction to the VNC concept VNC = Virtual Network Computing What are VNC server and VNC Viewer? Where do they run?

Following figure is from https://archive.realvnc.com/products/vnc/documentation/4.2/win/winvncviewer.pdf

I have annotated it to explain our specific situation.

======Extract from https://www.ucl.ac.uk/isd/

======

This document narrates how you can run Questasim on our Unix servers and view the GUI () on our laptop.

We have two documents: 1. VNC_to_viterbi-scfN_via_SSH_Tunnel_Windows.docx (this document for students with a Windows laptop) 2. VNC_to_viterbi-scfN_via_SSH_Tunnel_Mac.docx (another document for students with a Mac)

How to use VNC to run Questasim on vieterbi-scfN (via establishing SSH Tunneling to connect to viterbi-scfN)

The following was used as a resource: https://community.time4vps.com/discussion/120/how-to-connect-to-vnc-server-ussing-ssh-tunnel

First time:

A. First install VNC Viewer on your Windows laptop. This is done just one time. RealVnc helps users to work on GUI-based UNIX tools (for example, Questasim on our UNIX system). You need a viewer only, not “the server + viewer combination”. Go to http://www.realvnc.com/download/viewer/ This shows a download button with the following link

https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.20.529-Windows.exe Download the viewer (version 6.20.529 as of Jan. 2021 or later) and install on your windows laptop.

B. Login to your Unix account and check the contents of your .vnc/xstartup and see if your xstartup file has the same content as mine as shown below. If the content is different, fix the content. Or if the xstartup file does not even exist, create it with the following content. It is best to copy and paste. viterbi-scf1-ee457lab{112} more .vnc/xstartup #!/bin/sh

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey -geometry 80x24+10+10 -title "$VNCDESKTOP Desktop" & fvwm & One simple way is to move your .vnc/xstartup if it exists to a different name (say .vnc/xstartup_OLD and get it from my eeview account as shown below. To move an existing directory, we can use /bin/rm .vnc/xstartup .vnc/xstartup_OLD To remove an existing directory, we can use the command /bin/rm .vnc/xstartup Then copy cp -p ~eeview/COPY_OF_VNC_xstartup .vnc/xstartup

C. Also check to see if you have a .fvwm (F Virtual ) subdirectory with the following files.

If you have been using VNC for other courses and you are happy with it and if you do not have .fvwm, you can skip this step. FVWM is optional. If you are new to VNC, I recommend that you go for fvwm. Most likely you may not have the directory itself. Or you may have an empty directory. If you have an empty .fvwm directory, use the following command to get the files from my eeview account. cp -p ~eeview/COPY_OF_fvwm_Dir/* .fvwm/ If you do not even have an empty .fvwm directory, then use the following command. cp -pR ~eeview/COPY_OF_fvwm_Dir .fvwm The following illustrates copying the entire directory and its contents recursively into my ee201 account from my eeview account.

Every time: There are three steps: 0. Do VPN (optional => hence unnecessary => hence skip it as it can increase delay in responses) 1. Run VNC Server (Unix command vncserver) on Viterbi-scfN.usc.edu 2. Establishing the SSH tunnel 3. Run VNC viewer on your windows laptop 0. DO VPN (skip this step)

1. Run VNC server on Viterbi-scfN

Login to viterbi-scf1 or viterbi-scf2 (use putty or any ssh utility/tool).

Run vncserver:

$ vncserver -geometry 1920x1080 You can change the resolution of your VNC using -geometry switch. 1920x1080 is the resolution on my laptop display.

At the end of using Questasim (or whatever GUI-based tool on Unix you are using), come back to your PuTTy window and kill the server running on viterbi-scfN using either vncserver -kill :100NN or vncserver -autokill This will terminate your vncserver session when you finish working.

$ vncserver -autokill

$ vncserver -kill :100NN // your vnc display number

NOTE: vncserver will not automatically terminate unless you use one of the two commands above. You should kill the vncserver unless you are planning to reconnect to the vncserver in the next few minutes. Terminating vncserver on Unix will free up Unix system resources for others.

You can check your running vncserver processes:

$ vncserver -list

Notice that I have used viterbi-scf1 above, but you can also use viterbi-scf2 also.

Please notice the two display numbers 10001 (100NN) and 15001 (150NN) in the above Unix snip. You use the display number 10001 (100NN) with the vncserver -kill. You use the display number 15001 (150NN) with the “vncviewer” later in step #3.

On viterbi-scfN, if you haven’t run vncserver before, it’ll ask you to set a password for your VNC sessions. This password has nothing to do with your Unix account login password It will ask you if you want a read-only password as well, but you don’t need to set a read-only password unless you want someone to see your sessions.

Your chosen password is stored in a file called passwd (.vnc/passwd). If you had set a password long back but don’t remember what it is, then you can reset your password by removing the file .vnc/passwd.

$ rm .vnc/passwd

Then when you run vncserver again, it will ask you to set a password.

2. Establishing the tunnel

Login to your Unix server (viterbi-scfN)

Using Putty for windows):

Start putty. Usually it opens with the Sessions category active. Expand the Connection => SSH

Connection => SSH => Tunnels will bring you to

Fill in the number for source as 15001 and destination as localhost:15001 (no space before or after the colon : ) as shown below. You could use any number for source but there’s no reason not to use the same number. Then hit “Add”

After the above (without hitting Open), please go back to the Sessions category.

In this pane, do not load a previous saved session, as that would nullify the tunneling info that we have just put in.

Actually, type in manually Viterbi-scf1.usc.edu as shown below

Login to your viterbi-scf1 account again. You can leave the Unix terminal window open and use if needed.

3. Running the VNC viewer

Bring up your local VNC viewer on your laptop.

You can use any kind of VNC viewer tools, such as the Real VNC Viewer which we are using here or TightVNC, etc. Add the remote host as shown: Hit Connect. The screenshots below show the procedure to add connection on VNC Viewer. (Link to download: https://www.realvnc.com/download/viewer/)

Right-click in the white space somewhere in the main window and choose New connection…

On the subsequent window that opens after selecting “New Connection…”, add the VNC server as shown below. Type localhost:15001 (without any spaces before or after the colon : ). Click OK

This adds a new connection on your VNC Viewer’s main window.

A new connection is added to your VNC Viewer’s main window. Next time if it is again 15001, you do no have to recreate it. You can use this one.

Here you’ll enter the password you had set for your VNC on your Unix before/while invoking the vncserver on Unix.

If you get a “desktop” like this, it means that your fvwm is not working. Please check your .vnc/xstartup on your Unix account to find if it is missing the fvwm & command. But, if you have been using VNC in this fashion and are happy with this, there is no need to correct.

You can invoke additional using xterm & command at the Unix prompt above.

This figure is again with no fvwm & command in .vnc/xstartup

Also, there are some controls at the top center

Now (in the xterm on your desktop) you can go to your Questasim project directory (like the middle_finder project directory) and invoke the Questasim tool using the command vsim &

With proper fvwm & command, the vnc viewer window appears as shown below. I think this is more functional.

I need to findout how to change font size in xterm.

Now you can navigate to a Questasim project folder such as ~/Questasim_project/middle_finder in my tutorial and invoke Questasim using vsim & command as shown below.