source: etherws/trunk/README.rst @ 170

Revision 170, 5.8 KB checked in by atzm, 12 years ago (diff)
  • version bump
  • Property svn:keywords set to Id
RevLine 
[141]1Introduction
2============
3etherws is an implementation of Ethernet over WebSocket tunnel
4based on Linux Universal TUN/TAP device driver.
5
[152]6How to Use
7==========
8For example, if you want to make virtual ethernet link for *VM1* and *VM2*
[170]9whose hypervisor's broadcast domains were isolated by router *R*::
[141]10
11  +------------------+            +------------------+
12  | Hypervisor1      |            |      Hypervisor2 |
13  |  +-----+         |            |         +-----+  |
14  |  | VM1 |         |            |         | VM2 |  |
15  |  +--+--+         |            |         +--+--+  |
16  |     | (vnet0)    |            |    (vnet0) |     |
17  |  +--+--+         |            |         +--+--+  |
18  |  | br0 |         |            |         | br0 |  |
19  |  +--+--+         |            |         +--+--+  |
20  |     |            |            |            |     |
21  | (ethws0)  (eth0) |            | (eth0)  (ethws0) |
22  +----||--------+---+            +----+-------||----+
23       ||        |        +---+        |       ||
24       ||   -----+--------| R |--------+-----  ||
25       ||                 +---+                ||
26       ||                                      ||
27       ``======================================''
28            (Ethernet over WebSocket tunnel)
29
[152]30then you can use following commands.
[141]31
[152]32on *Hypervisor1*::
[141]33
[170]34  # etherws --device ethws0 server
[141]35  # brctl addbr br0
36  # brctl addif br0 vnet0
37  # brctl addif br0 ethws0
38  # ifconfig br0 up
39
[152]40on *Hypervisor2*::
[141]41
[170]42  # etherws --device ethws0 client --uri ws://<Hypervisor1's IP address>/
[141]43  # brctl addbr br0
44  # brctl addif br0 vnet0
45  # brctl addif br0 ethws0
46  # ifconfig br0 up
47
[162]48Additionally, you may improve performance by increasing MTU.
49For example,
[146]50
[162]51on each hypervisor::
[144]52
[162]53 # ifconfig vnet0 mtu 16436
54 # ifconfig ethws0 mtu 16436
55
56on each VM::
57
58 # ifconfig eth0 mtu 16436
59
[156]60Using SSL/TLS
61=============
62etherws supports SSL/TLS connection.
[170]63If you want to encrypt tunnels, then you can use following options.
[144]64
[156]65on *Hypervisor1*::
[152]66
[170]67  # etherws --device ethws0 server --keyfile ssl.key --certfile ssl.crt
[144]68
[156]69*ssl.key* is a server private key, and *ssl.crt* is a server certificate.
[144]70
[156]71Now you also can test SSL/TLS connection by following command::
[144]72
[152]73  # openssl s_client -connect <Hypervisor1's IP address>:443
74
[156]75on *Hypervisor2*::
76
[170]77  # etherws --device ethws0 client --uri wss://<Hypervisor1's IP address>/ --cacerts ssl.crt
[156]78
79Here, URI scheme was just changed to *wss*, and CA certificate to verify
80server certificate was specified.
81
82By the way, client verifies server certificate by default.
83So, for example, client will die with error messages if your server uses
84self-signed certificate and client uses another CA certificate.
85
[170]86If you want to just encrypt tunnels and do not need to verify
[156]87certificate, then you can use following option::
88
[170]89  # etherws --device ethws0 client --uri wss://<Hypervisor1's IP address>/ --insecure
[156]90
[158]91Note: see `<http://docs.python.org/library/ssl.html>`_
[156]92for more information about certificates.
93
[152]94Client Authentication
95=====================
96etherws supports HTTP Basic Authentication.
97It means you can use etherws as simple L2-VPN server/client.
98
99On server side, etherws requires user information in Apache htpasswd
100format (and currently supports SHA-1 digest only). To create this file::
101
102  # htpasswd -s -c filename username
103
104If you do not have htpasswd command, then you can use python one-liner::
105
106  # python -c 'import hashlib; print("username:{SHA}" + hashlib.sha1("password").digest().encode("base64"))'
107
108To run server with this::
109
[170]110  # etherws --device ethws0 server --htpasswd filename
[152]111
112You also can test by following command::
113
114  # telnet <address> 80
115  GET / HTTP/1.1
116
117It will return *401 Authorization Required*.
118
[160]119On client side, etherws requires username from option, and password from
120option or stdin::
[152]121
[170]122  # etherws --device ethws0 client --uri ws://<address>/ --user username --passwd password
123  # etherws --device ethws0 client --uri ws://<address>/ --user username
[152]124  Password:
125
126If authentication did not succeed, then it will die with some error messages.
127
128Note that you should not use HTTP Basic Authentication without SSL/TLS
129support, because it is insecure in itself.
130
[170]131Complex Examples
132================
133etherws has simple virtual Ethernet switch in itself and it can handle multiple
134TAP interfaces or WebSocket connections as virtual switch port::
135
136  (A)# etherws --device ethws0 --device ethws1 --device ethws2 server
137  (B)# etherws --device ethws0 server
138  (C)# etherws --device ethws0 --device ethws1 client --uri ws://x.x.x.x/
139  (D)# etherws --device ethws0 client --uri ws://x.x.x.x/ --uri ws://y.y.y.y/
140
141This will create following network::
142
143       (ethws0)  (ethws1)  (ethws2)             (ethws0)
144           |        |         |                    |
145     +-----+--------+---------+-----+     +--------+--------+
146     |           server (A)         |     |   server (B)    |
147     |        (ws://x.x.x.x/)       |     | (ws://y.y.y.y/) |
148     +-----+------------------+-----+     +-----+-----------+
149           |                  |                 |
150           |    (WebSocket)   |    +------------+
151           |                  |    |
152   +-------+------+   +-------+----+--+
153   |  client (C)  |   |   client (D)  |
154   +--+--------+--+   +-------+-------+
155      |        |              |
156  (ethws0)  (ethws1)      (ethws0)
157
158Also you can use TAP interface which is created by etherws as 802.1Q VLAN
159interface using vconfig command and so on.
160
[141]161History
162=======
[170]1630.7 (2012-06-29 JST)
164  - switching support
165  - multiple ports support
166
[162]1670.6 (2012-06-16 JST)
168  - improve performance
169
[160]1700.5 (2012-05-20 JST)
171  - added passwd option to client mode
172  - fixed bug: basic authentication password cannot contain colon
173  - fixed bug: client loops meaninglessly even if server stops
174
[158]1750.4 (2012-05-19 JST)
176  - server certificate verification support
177
[152]1780.3 (2012-05-17 JST)
179  - client authentication support
180
[144]1810.2 (2012-05-16 JST)
182  - SSL/TLS connection support
183
1840.1 (2012-05-15 JST)
[141]185  - First release
Note: See TracBrowser for help on using the repository browser.