Setting up SSH on the system simulator

From Cellbe

(Difference between revisions)
(nDoYvEKFqor)
 
(13 intermediate revisions not shown)
Line 1: Line 1:
-
This article explains how to setup ssh your host and your simulated environment. At the end, you will be able to run ssh to connect to your host from the simulated environment, and viceversa.
+
Unless they have recently chaengd the requirements, it should not be a problem providing that she meets the eligibility required for her working visa. Different employers may require certain certifications, but with her experience, she sounds like she is very qualifiedI've looked into it as I was considering moving there to teach as wellI wish her the best!As far as I know, New Zealand does not require a certificate unless they recently chaengd their requirementsReferences : Yoga teacher
-
This information can be (partially) found on the ''IBM system simulator user guide'' (on a default sdk installation, this can be found on <tt>/opt/ibm/systemsim-cell/doc/SystemSim.Users.guide</tt>)
+
-
 
+
-
The following conventions will be used:
+
-
*'''$''' your user bash prompt in the ''host'' environment
+
-
*'''#''' your root bash prompt in the ''host'' environment
+
-
*'''[root@(none) ~]#''' The bash prompt in the ''simulated environment''
+
-
*'''%''' The TCL simulator shell.
+
-
<!--XXX: aggiungere il colore per l'editing dei file -->
+
-
===Environment===
+
-
This applies to the last SDK version (2.1), and assumes it is installed on a Fedora Core 6 (''FC6'') host. Root access on the host is '''required'''.
+
-
===Setting up the TUN/TAP interfaces on the host===
+
-
Make sure the device <tt>/dev/net/tun</tt> exists on the host. On a default FC6 installation it does. By default, tap interfaces are usable only by the root user. If you want to start the simulator as a normal user, you have to make them usable by normal users. To do it, issue
+
-
<pre>
+
-
$ su -
+
-
</pre>
+
-
You will be asked for the root password. Create and edit the file <tt>/etc/udev/rules.d/systemsim.rules</tt> and write in
+
-
<pre>
+
-
KERNEL=="tun", MODE="0666"
+
-
</pre>
+
-
Reboot your host to make your changes effective.
+
-
 
+
-
The user who runs the simulator has to create a tap interface with the command <tt>snif</tt> (it should be installed with the sdk). To create an interface with <tt>snif</tt>, just run
+
-
 
+
-
  $ snif -c -u ''uid'' ''ip_address''
+
-
 
+
-
* ''uid'' should be set to the numerical user id of the user who runs the simulator (you can look for it in <tt>/etc/passwd</tt>, or just run the command <tt>id</tt> at the host command prompt)
+
-
* ''ip_address'' should be set to an ip address that it's on the same network of the eth0 interface of the simulator. By default the ip address of eth0 on the simulator is <tt>172.20.0.2</tt>, so you can set the ip address to <tt>172.20.0.XXX</tt>
+
-
example:
+
-
<pre>
+
-
$ id
+
-
uid=1005(ale) gid=1005(ale) groups=1005(ale) context=user_u:system_r:unconfined_t
+
-
 
+
-
$ snif -c -u 1005 172.20.0.1
+
-
tap0
+
-
</pre>
+
-
Take note of what <tt>snif</tt> outputs (the name of the interface just created - tipically tap0), you will need it later.
+
-
 
+
-
===Setting up the simulator===
+
-
The first thing to do is to setup the bogus network on the simulator. In your sandbox directory (if you don't have one, create it - e.g. <tt>~/sandbox</tt>) edit the file <tt>.systemsim.tcl</tt> - if you don't have one yet, copy the one <tt>systemsim</tt> uses by default, found in <tt>/opt/ibm/systemsim-cell/run/cell/linux/.systemsim.tcl</tt>.
+
-
At the end of the file, put this line:
+
-
  mysim bogus net init 0 00:50:56:C0:00:01 ''tap0'' 0 0
+
-
Substitute <tt>00:50:56:C0:00:01</tt> with a dummy mac address of your choice (tipically, one not used in your network), and substitute ''<tt>tap0</tt>'' with the interface you created with <tt>snif</tt>.
+
-
 
+
-
Now, you should be able to connect from the simulator to the host with ssh, but not viceversa. As a quick and dirty hack, we setup the simulator disk to be ''persistent'', and start <tt>sshd</tt> in the simulated environment from root's <tt>.bashrc</tt> (I'll explain why in the next section). In your <tt>.systemsim.tcl</tt> file, change the line
+
-
+
-
mysim bogus disk init 0 $sysrootfile ''newcow'' sysroot_disk.cow 1024
+
-
to
+
-
mysim bogus disk init 0 $sysrootfile ''cow'' sysroot_disk.cow 1024
+
-
Save the changes and run the simulator from the sandbox directory.
+
-
====About the persistent disk====
+
-
Make '''sure''' you sync the bogus disk before shutting down the simulator to keep the disk in a consistent state! You can do this by typing
+
-
% mysim bogus disk sync 0
+
-
at the simulator TCL shell prompt.
+
-
===Setting up the simulated environment===
+
-
Now the dirty hack: to make sshd start on boot, edit root's .bashrc on the simulated environment:
+
-
[root@(none) ~]# vi .bashrc
+
-
and at the end of the file add this line:
+
-
/etc/init.d/sshd start
+
-
then save and exit, and source your .bashrc:
+
-
 
+
-
[root@(none) ~]# source .bashrc
+
-
 
+
-
This surely is a dirty way to make it start sshd on boot, but we didn't find a better way (<tt>chkconfig sshd </tt> on did not work).
+
-
Now you should be able to ssh to the simulated environment, running
+
-
$ ssh root@172.20.0.2
+
-
at the bash prompt on your host. But there's a problem: in the simulated environment changing the password with passwd gave an error message. We solved it appending our public keys in the simulated environment:
+
-
At your host prompt, generate your public keys:
+
-
$ ssh-keygen -t rsa
+
-
Now, from the simulated environment, copy your key file, and then append it to your authorized_keys file.
+
-
[root@(none) ~]# scp ''user''@host:~/.ssh/id_rsa.pub .
+
-
[root@(none) ~]# cat id_rsa.pub >> ~/.ssh/authorized_keys
+
-
Substitute <tt>''user''</tt> with your user name on the host of course, and do this for each user you want to have access on your simulated machine.
+
-
To make this changes persistent, sync your simulated disk:
+
-
press Ctrl-c in the simulator tcl shell window to obtain the prompt, and then type:
+
-
% mysim bogus disk sync 0
+
-
You can resume the simulator typing
+
-
% mysim go
+
-
Now, ssh should work: at your host prompt, type
+
-
$ ssh root@172.20.0.2
+
-
If everything went well, it should ask you no password, and take you to the simulator prompt.
+
-
 
+
-
[[User:Admin|laynor]] 07:40, 4 July 2007 (EDT)
+

Current revision as of 20:33, 20 November 2015

Unless they have recently chaengd the requirements, it should not be a problem providing that she meets the eligibility required for her working visa. Different employers may require certain certifications, but with her experience, she sounds like she is very qualified. I've looked into it as I was considering moving there to teach as well. I wish her the best!As far as I know, New Zealand does not require a certificate unless they recently chaengd their requirementsReferences : Yoga teacher

Personal tools