Add host » History » Version 11
Anchi Cheng, 08/12/2014 02:40 PM
1 | 2 | Anchi Cheng | h2. Add the IP address and matching hostname of the microscope and digital camera computer in your host file on the main Leginon computer, and vice versa. |
---|---|---|---|
2 | 1 | Anchi Cheng | |
3 | 11 | Anchi Cheng | h3. Find out what python thinks the hostname is with python command line. REPEAT this both on Linux and Windows PC |
4 | 3 | Anchi Cheng | |
5 | Run the following in python command line: |
||
6 | <pre> |
||
7 | import socket |
||
8 | socket.gethostname() |
||
9 | </pre> |
||
10 | 1 | Anchi Cheng | |
11 | 8 | Anchi Cheng | h3. Find out the ip address associate with the hostname |
12 | |||
13 | Run the following in python command line: |
||
14 | 4 | Anchi Cheng | <pre> |
15 | 8 | Anchi Cheng | import socket |
16 | socket.gethostbyname('your_host_name') |
||
17 | 4 | Anchi Cheng | </pre> |
18 | 2 | Anchi Cheng | |
19 | 10 | Anchi Cheng | h3. REPEAT the above on each instrument WIndows PC* so you have all the information. |
20 | 1 | Anchi Cheng | |
21 | 10 | Anchi Cheng | h3. Modify your "hosts" file on the linux Leginon computer to include the instrument hosts if the latter is not already mapped by your domain name server |
22 | |||
23 | * On Linux, this "hosts" file is at |
||
24 | 1 | Anchi Cheng | > /etc/hosts |
25 | |||
26 | 10 | Anchi Cheng | Example of a "hosts" file: |
27 | 8 | Anchi Cheng | |
28 | 1 | Anchi Cheng | <pre> |
29 | 8 | Anchi Cheng | 192.000.1.222 instrument_host_name.domain_name instrument_short_host_name |
30 | </pre> |
||
31 | |||
32 | 10 | Anchi Cheng | h3. Use shorter linux hostname if desired |
33 | 9 | Anchi Cheng | |
34 | 8 | Anchi Cheng | If you'd like to shorten your linux hostname recognized by socket without the domain name, you may do so as root |
35 | <pre> |
||
36 | hostname your_shorter_hostname |
||
37 | </pre> |
||
38 | |||
39 | and also add that to the /etc/hosts as an alternative name |
||
40 | <pre> |
||
41 | 192.000.1.333 long_host_name.domain_name your_shorter_hostname |
||
42 | </pre> |
||
43 | 9 | Anchi Cheng | |
44 | You will need to restart networking to make it persistent. |
||
45 | <pre> |
||
46 | /etc/init.d/network restart |
||
47 | </pre> |
||
48 | |||
49 | Test the change by finding the ip address with the hostname as in the above section. |
||
50 | 8 | Anchi Cheng | |
51 | h3. The Linux main Leginon computer also needs to identify itself by its hostname registered on the instrument Windows computer. |
||
52 | 1 | Anchi Cheng | |
53 | 7 | Anchi Cheng | * On Window XP and WIndows 7 this host file is |
54 | 1 | Anchi Cheng | > C:\\WINDOWS\system32\drivers\etc\hosts |
55 | |||
56 | 7 | Anchi Cheng | * On Window NT, this host file is |
57 | 1 | Anchi Cheng | > C:\\WINNT\system32\drivers\etc\hosts |