この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
mae3xx_tips:setup_openvpn:setup_server:start [2019/02/25 14:49] admin |
mae3xx_tips:setup_openvpn:setup_server:start [2019/02/25 16:41] (現在) admin |
||
---|---|---|---|
ライン 1: | ライン 1: | ||
- | ====== サーバ側の設定 ====== | + | ====== サーバ側での作業 ====== |
- | Ubuntu が楽なので、ベース部分に Ubuntu Linux 14.04LTS を導入済みの環境を前提とします。\\ | + | ===== OpenVPN パッケージのインストール ===== |
- | <code> | + | Ubuntu 18.04 のサーバに、OpenVPN をセットアップします。 |
- | # cat /etc/os-release | + | |
- | NAME="Ubuntu" | + | |
- | VERSION="14.04.1 LTS, Trusty Tahr" | + | |
- | ID=ubuntu | + | |
- | ID_LIKE=debian | + | |
- | PRETTY_NAME="Ubuntu 14.04.1 LTS" | + | |
- | VERSION_ID="14.04" | + | |
- | HOME_URL="http://www.ubuntu.com/" | + | |
- | SUPPORT_URL="http://help.ubuntu.com/" | + | |
- | BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" | + | |
- | </code> | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | Docker を使用する場合は、[[https://coreos.com/|CoreOS]] を使うのもよいかもしれません。 | + | |
- | + | ||
- | 参考: [[http://qiita.com/mopemope/items/fa9424b094aae3eac580|CoreOS 入門 - Qiita]] | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | ===== LXC を使用する ===== | + | |
- | + | ||
- | LXC を使用するために、パッケージから | + | |
- | * lxc | + | |
- | * lxc-templates (lxc と一緒にインストールされます) | + | |
- | をインストールしておきます。 | + | |
<code> | <code> | ||
- | root@macaron:~# apt-get install lxc | + | root@bionic-openvpn:~# apt install openvpn easy-rsa openresolv |
Reading package lists... Done | Reading package lists... Done | ||
Building dependency tree | Building dependency tree | ||
Reading state information... Done | Reading state information... Done | ||
- | The following extra packages will be installed: | + | The following additional packages will be installed: |
- | lxc-templates | + | libccid libpcsclite1 libpkcs11-helper1 opensc opensc-pkcs11 pcscd |
- | … | + | Suggested packages: |
+ | pcmciautils | ||
+ | The following NEW packages will be installed: | ||
+ | easy-rsa libccid libpcsclite1 libpkcs11-helper1 openresolv opensc opensc-pkcs11 openvpn pcscd | ||
+ | 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. | ||
+ | Need to get 1749 kB of archives. | ||
+ | After this operation, 5552 kB of additional disk space will be used. | ||
+ | Do you want to continue? [Y/n] | ||
</code> | </code> | ||
\\ | \\ | ||
- | ==== コンテナの作成 ==== | + | サーバ側では、[[https://www.openvpn.jp/document/how-to/|こちら]] を参照して設定をしておきます。 |
- | + | ||
- | "lxc-create" コマンドで、コンテナを作成します。テンプレートは、ホスト OS と同じ Ubuntu Linux を使用します。 | + | |
- | + | ||
- | <code> | + | |
- | root@macaron:~# lxc-create -n ubuntu -t ubuntu | + | |
- | Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ... | + | |
- | Installing packages in template: ssh,vim,language-pack-en | + | |
- | Downloading ubuntu trusty minimal ... | + | |
- | I: Retrieving Release | + | |
- | I: Retrieving Release.gpg | + | |
- | I: Checking Release signature | + | |
- | I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32) | + | |
- | 〜〜〜 中略 〜〜〜 | + | |
- | Generating locales... | + | |
- | en_US.UTF-8... up-to-date | + | |
- | Generation complete. | + | |
- | Creating SSH2 RSA key; this may take some time ... | + | |
- | Creating SSH2 DSA key; this may take some time ... | + | |
- | Creating SSH2 ECDSA key; this may take some time ... | + | |
- | Creating SSH2 ED25519 key; this may take some time ... | + | |
- | update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match ssh Default-Stop values (none) | + | |
- | invoke-rc.d: policy-rc.d denied execution of start. | + | |
- | + | ||
- | Current default time zone: 'Asia/Tokyo' | + | |
- | Local time is now: Tue Sep 9 12:09:56 JST 2014. | + | |
- | Universal Time is now: Tue Sep 9 03:09:56 UTC 2014. | + | |
- | + | ||
- | + | ||
- | ## | + | |
- | # The default user is 'ubuntu' with password 'ubuntu'! | + | |
- | # Use the 'sudo' command to run tasks as root in the container. | + | |
- | ## | + | |
- | + | ||
- | root@macaron:~# | + | |
- | </code> | + | |
- | + | ||
- | 作成されました。\\ | + | |
- | デフォルトで、ユーザ "ubuntu" が作成されます。 | + | |
- | + | ||
- | ネットワークは、デフォルトではこのように構成されます。 | + | |
- | + | ||
- | {{:mae3xx_tips:setup_openvpn:lxc_network.png|LXC network}} | + | |
- | + | ||
- | <code> | + | |
- | root@macaron:~# ip addr show lxcbr0 | + | |
- | 9: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default | + | |
- | link/ether 72:f5:1b:d1:75:8d brd ff:ff:ff:ff:ff:ff | + | |
- | inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0 | + | |
- | valid_lft forever preferred_lft forever | + | |
- | inet6 fe80::70f5:1bff:fed1:758d/64 scope link | + | |
- | valid_lft forever preferred_lft forever | + | |
- | </code> | + | |
\\ | \\ | ||
- | ==== コンテナの起動 ==== | + | ===== 設定ファイル ===== |
- | コンテナは作成されましたが、 | + | サーバ側で使用する config は下記のようにしました。 |
- | * ユーザアカウント | + | |
- | * ネットワーク | + | |
- | など、設定する必要があります。最初はネットワークの設定が DHCP に設定されていて割り当てられるアドレスがわからないため、フォアグランドで起動します。 | + | |
<code> | <code> | ||
- | root@macaron:~# lxc-start -n ubuntu | + | ################################################# |
- | <4>init: plymouth-upstart-bridge main process (5) terminated with status 1 | + | # Sample OpenVPN 2.0 config file for # |
- | <4>init: plymouth-upstart-bridge main process ended, respawning | + | # multi-client server. # |
- | <4>init: hwclock main process (7) terminated with status 77 | + | # # |
- | <4>init: ureadahead main process (8) terminated with status 5 | + | # This file is for the server side # |
- | <4>init: plymouth-upstart-bridge main process (15) terminated with status 1 | + | # of a many-clients <-> one-server # |
- | <4>init: plymouth-upstart-bridge main process ended, respawning | + | # OpenVPN configuration. # |
- | <4>init: plymouth-upstart-bridge main process (20) terminated with status 1 | + | # # |
- | <4>init: plymouth-upstart-bridge main process ended, respawning | + | # OpenVPN also supports # |
- | * Starting Mount filesystems on boot ...done. | + | # single-machine <-> single-machine # |
+ | # configurations (See the Examples page # | ||
+ | # on the web site for more info). # | ||
+ | # # | ||
+ | # This config should work on Windows # | ||
+ | # or Linux/BSD systems. Remember on # | ||
+ | # Windows to quote pathnames and use # | ||
+ | # double backslashes, e.g.: # | ||
+ | # "C:\\Program Files\\OpenVPN\\config\\foo.key" # | ||
+ | # # | ||
+ | # Comments are preceded with '#' or ';' # | ||
+ | ################################################# | ||
- | … 起動メッセージが続きます | + | # Which local IP address should OpenVPN |
- | </code> | + | # listen on? (optional) |
+ | ;local a.b.c.d | ||
- | <code> | + | # Which TCP/UDP port should OpenVPN listen on? |
- | Ubuntu 14.04.1 LTS ubuntu console | + | # If you want to run multiple OpenVPN instances |
+ | # on the same machine, use a different port | ||
+ | # number for each one. You will need to | ||
+ | # open up this port on your firewall. | ||
+ | port 1194 | ||
- | ubuntu login: <4>init: setvtrgb main process (420) terminated with status 1 | + | # TCP or UDP server? |
- | * Stopping save kernel messages ...done. | + | ;proto tcp |
- | <4>init: plymouth-upstart-bridge main process ended, respawning | + | proto udp |
+ | # "dev tun" will create a routed IP tunnel, | ||
+ | # "dev tap" will create an ethernet tunnel. | ||
+ | # Use "dev tap0" if you are ethernet bridging | ||
+ | # and have precreated a tap0 virtual interface | ||
+ | # and bridged it with your ethernet interface. | ||
+ | # If you want to control access policies | ||
+ | # over the VPN, you must create firewall | ||
+ | # rules for the the TUN/TAP interface. | ||
+ | # On non-Windows systems, you can give | ||
+ | # an explicit unit number, such as tun0. | ||
+ | # On Windows, use "dev-node" for this. | ||
+ | # On most systems, the VPN will not function | ||
+ | # unless you partially or fully disable | ||
+ | # the firewall for the TUN/TAP interface. | ||
+ | ;dev tap | ||
+ | dev tun | ||
- | Ubuntu 14.04.1 LTS ubuntu console | + | # Windows needs the TAP-Win32 adapter name |
+ | # from the Network Connections panel if you | ||
+ | # have more than one. On XP SP2 or higher, | ||
+ | # you may need to selectively disable the | ||
+ | # Windows firewall for the TAP adapter. | ||
+ | # Non-Windows systems usually don't need this. | ||
+ | ;dev-node MyTap | ||
- | ubuntu login: | + | # SSL/TLS root certificate (ca), certificate |
- | </code> | + | # (cert), and private key (key). Each client |
+ | # and the server must have their own cert and | ||
+ | # key file. The server and all clients will | ||
+ | # use the same ca file. | ||
+ | # | ||
+ | # See the "easy-rsa" directory for a series | ||
+ | # of scripts for generating RSA certificates | ||
+ | # and private keys. Remember to use | ||
+ | # a unique Common Name for the server | ||
+ | # and each of the client certificates. | ||
+ | # | ||
+ | # Any X509 key management system can be used. | ||
+ | # OpenVPN can also use a PKCS #12 formatted key file | ||
+ | # (see "pkcs12" directive in man page). | ||
+ | ca /etc/openvpn/easy-rsa/keys/ca.crt | ||
+ | cert /etc/openvpn/easy-rsa/keys/server.crt | ||
+ | key /etc/openvpn/easy-rsa/keys/server.key # This file should be kept secret | ||
- | \\ | + | # Diffie hellman parameters. |
+ | # Generate your own with: | ||
+ | # openssl dhparam -out dh2048.pem 2048 | ||
+ | dh /etc/openvpn/easy-rsa/keys/dh2048.pem | ||
- | 初期設定された、"ubuntu" でログインできます。 | + | # Network topology |
+ | # Should be subnet (addressing via IP) | ||
+ | # unless Windows clients v2.0.9 and lower have to | ||
+ | # be supported (then net30, i.e. a /30 per client) | ||
+ | # Defaults to net30 (not recommended) | ||
+ | ;topology subnet | ||
- | <code> | + | # Configure server mode and supply a VPN subnet |
- | Ubuntu 14.04.1 LTS ubuntu console | + | # for OpenVPN to draw client addresses from. |
+ | # The server will take 10.8.0.1 for itself, | ||
+ | # the rest will be made available to clients. | ||
+ | # Each client will be able to reach the server | ||
+ | # on 10.8.0.1. Comment this line out if you are | ||
+ | # ethernet bridging. See the man page for more info. | ||
+ | server 10.8.0.0 255.255.255.0 | ||
- | ubuntu login: ubuntu | + | # Maintain a record of client <-> virtual IP address |
- | Password: | + | # associations in this file. If OpenVPN goes down or |
- | Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-35-generic x86_64) | + | # is restarted, reconnecting clients can be assigned |
+ | # the same virtual IP address from the pool that was | ||
+ | # previously assigned. | ||
+ | ifconfig-pool-persist /var/log/openvpn/ipp.txt | ||
- | * Documentation: https://help.ubuntu.com/ | + | # Configure server mode for ethernet bridging. |
+ | # You must first use your OS's bridging capability | ||
+ | # to bridge the TAP interface with the ethernet | ||
+ | # NIC interface. Then you must manually set the | ||
+ | # IP/netmask on the bridge interface, here we | ||
+ | # assume 10.8.0.4/255.255.255.0. Finally we | ||
+ | # must set aside an IP range in this subnet | ||
+ | # (start=10.8.0.50 end=10.8.0.100) to allocate | ||
+ | # to connecting clients. Leave this line commented | ||
+ | # out unless you are ethernet bridging. | ||
+ | ;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100 | ||
- | The programs included with the Ubuntu system are free software; | + | # Configure server mode for ethernet bridging |
- | the exact distribution terms for each program are described in the | + | # using a DHCP-proxy, where clients talk |
- | individual files in /usr/share/doc/*/copyright. | + | # to the OpenVPN server-side DHCP server |
+ | # to receive their IP address allocation | ||
+ | # and DNS server addresses. You must first use | ||
+ | # your OS's bridging capability to bridge the TAP | ||
+ | # interface with the ethernet NIC interface. | ||
+ | # Note: this mode only works on clients (such as | ||
+ | # Windows), where the client-side TAP adapter is | ||
+ | # bound to a DHCP client. | ||
+ | ;server-bridge | ||
- | Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by | + | # Push routes to the client to allow it |
- | applicable law. | + | # to reach other private subnets behind |
+ | # the server. Remember that these | ||
+ | # private subnets will also need | ||
+ | # to know to route the OpenVPN client | ||
+ | # address pool (10.8.0.0/255.255.255.0) | ||
+ | # back to the OpenVPN server. | ||
+ | ;push "route 192.168.10.0 255.255.255.0" | ||
+ | ;push "route 192.168.20.0 255.255.255.0" | ||
- | ubuntu@ubuntu:~$ | + | # To assign specific IP addresses to specific |
- | </code> | + | # clients or if a connecting client has a private |
+ | # subnet behind it that should also have VPN access, | ||
+ | # use the subdirectory "ccd" for client-specific | ||
+ | # configuration files (see man page for more info). | ||
- | \\ | + | # EXAMPLE: Suppose the client |
+ | # having the certificate common name "Thelonious" | ||
+ | # also has a small subnet behind his connecting | ||
+ | # machine, such as 192.168.40.128/255.255.255.248. | ||
+ | # First, uncomment out these lines: | ||
+ | ;client-config-dir ccd | ||
+ | ;route 192.168.40.128 255.255.255.248 | ||
+ | # Then create a file ccd/Thelonious with this line: | ||
+ | # iroute 192.168.40.128 255.255.255.248 | ||
+ | # This will allow Thelonious' private subnet to | ||
+ | # access the VPN. This example will only work | ||
+ | # if you are routing, not bridging, i.e. you are | ||
+ | # using "dev tun" and "server" directives. | ||
- | IP アドレスは、ホスト側 lxcbr0 と同じネットワーク (10.0.3.0/24) のアドレスが割り当てられていることがわかります。 | + | # EXAMPLE: Suppose you want to give |
+ | # Thelonious a fixed VPN IP address of 10.9.0.1. | ||
+ | # First uncomment out these lines: | ||
+ | ;client-config-dir ccd | ||
+ | ;route 10.9.0.0 255.255.255.252 | ||
+ | # Then add this line to ccd/Thelonious: | ||
+ | # ifconfig-push 10.9.0.1 10.9.0.2 | ||
- | <code> | + | # Suppose that you want to enable different |
- | ubuntu@ubuntu:~$ ip addr show eth0 | + | # firewall access policies for different groups |
- | 10: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 | + | # of clients. There are two methods: |
- | link/ether 00:16:3e:99:4f:ac brd ff:ff:ff:ff:ff:ff | + | # (1) Run multiple OpenVPN daemons, one for each |
- | inet 10.0.3.25/24 brd 10.0.3.255 scope global eth0 | + | # group, and firewall the TUN/TAP interface |
- | valid_lft forever preferred_lft forever | + | # for each group/daemon appropriately. |
- | inet6 fe80::216:3eff:fe99:4fac/64 scope link | + | # (2) (Advanced) Create a script to dynamically |
- | valid_lft forever preferred_lft forever | + | # modify the firewall in response to access |
- | ubuntu@ubuntu:~$ | + | # from different clients. See man |
- | </code> | + | # page for more info on learn-address script. |
+ | ;learn-address ./script | ||
- | \\ | + | # If enabled, this directive will configure |
+ | # all clients to redirect their default | ||
+ | # network gateway through the VPN, causing | ||
+ | # all IP traffic such as web browsing and | ||
+ | # and DNS lookups to go through the VPN | ||
+ | # (The OpenVPN server machine may need to NAT | ||
+ | # or bridge the TUN/TAP interface to the internet | ||
+ | # in order for this to work properly). | ||
+ | ;push "redirect-gateway def1 bypass-dhcp" | ||
- | 外部のホストへのアクセスもできることを確認しておきます。 | + | # Certain Windows-specific network settings |
+ | # can be pushed to clients, such as DNS | ||
+ | # or WINS server addresses. CAVEAT: | ||
+ | # http://openvpn.net/faq.html#dhcpcaveats | ||
+ | # The addresses below refer to the public | ||
+ | # DNS servers provided by opendns.com. | ||
+ | ;push "dhcp-option DNS 208.67.222.222" | ||
+ | ;push "dhcp-option DNS 208.67.220.220" | ||
- | <code> | + | # Uncomment this directive to allow different |
- | ubuntu@ubuntu:~$ ping -c 2 www.yahoo.co.jp | + | # clients to be able to "see" each other. |
- | PING www.g.yahoo.co.jp (183.79.231.182) 56(84) bytes of data. | + | # By default, clients will only see the server. |
- | 64 bytes from f12.top.vip.ogk.yahoo.co.jp (183.79.231.182): icmp_seq=1 ttl=51 time=30.7 ms | + | # To force clients to only see the server, you |
- | 64 bytes from f12.top.vip.ogk.yahoo.co.jp (183.79.231.182): icmp_seq=2 ttl=51 time=30.9 ms | + | # will also need to appropriately firewall the |
+ | # server's TUN/TAP interface. | ||
+ | ;client-to-client | ||
- | --- www.g.yahoo.co.jp ping statistics --- | + | # Uncomment this directive if multiple clients |
- | 2 packets transmitted, 2 received, 0% packet loss, time 1001ms | + | # might connect with the same certificate/key |
- | rtt min/avg/max/mdev = 30.772/30.843/30.914/0.071 ms | + | # files or common names. This is recommended |
- | ubuntu@ubuntu:~$ | + | # only for testing purposes. For production use, |
- | </code> | + | # each client should have its own certificate/key |
+ | # pair. | ||
+ | # | ||
+ | # IF YOU HAVE NOT GENERATED INDIVIDUAL | ||
+ | # CERTIFICATE/KEY PAIRS FOR EACH CLIENT, | ||
+ | # EACH HAVING ITS OWN UNIQUE "COMMON NAME", | ||
+ | # UNCOMMENT THIS LINE OUT. | ||
+ | ;duplicate-cn | ||
- | \\ | + | # The keepalive directive causes ping-like |
+ | # messages to be sent back and forth over | ||
+ | # the link so that each side knows when | ||
+ | # the other side has gone down. | ||
+ | # Ping every 10 seconds, assume that remote | ||
+ | # peer is down if no ping received during | ||
+ | # a 120 second time period. | ||
+ | keepalive 10 120 | ||
- | ==== コンテナの設定 ==== | + | # For extra security beyond that provided |
+ | # by SSL/TLS, create an "HMAC firewall" | ||
+ | # to help block DoS attacks and UDP port flooding. | ||
+ | # | ||
+ | # Generate with: | ||
+ | # openvpn --genkey --secret ta.key | ||
+ | # | ||
+ | # The server and each client must have | ||
+ | # a copy of this key. | ||
+ | # The second parameter should be '0' | ||
+ | # on the server and '1' on the clients. | ||
+ | ;tls-auth ta.key 0 # This file is secret | ||
- | Ubuntu Template でインストールしたままでは、eth0 の IP アドレスの割り当て方法が DHCP となっていて、\\ | + | # Select a cryptographic cipher. |
- | 外部からのパケットを転送するには不便なので、固定アドレスを割り当てておきます。\\ | + | # This config item must be copied to |
- | また、ホスト側で dnsmasq((DHCP server, DNS cache などを兼ねるスグレモノです)) が動作しているので、DNS をホストの IP アドレスにしてしまいます。 | + | # the client config file as well. |
+ | # Note that v2.4 client/server will automatically | ||
+ | # negotiate AES-256-GCM in TLS mode. | ||
+ | # See also the ncp-cipher option in the manpage | ||
+ | cipher AES-256-CBC | ||
- | デフォルト状態 | + | # Enable compression on the VPN link and push the |
- | <file conf interfaces.orig> | + | # option to the client (v2.4+ only, for earlier |
- | # This file describes the network interfaces available on your system | + | # versions see below) |
- | # and how to activate them. For more information, see interfaces(5). | + | ;compress lz4-v2 |
+ | ;push "compress lz4-v2" | ||
- | # The loopback network interface | + | # For compression compatible with older clients use comp-lzo |
- | auto lo | + | # If you enable it here, you must also |
- | iface lo inet loopback | + | # enable it in the client config file. |
+ | comp-lzo | ||
- | auto eth0 | + | # The maximum number of concurrently connected |
- | iface eth0 inet dhcp | + | # clients we want to allow. |
- | </file> | + | ;max-clients 100 |
- | 変更後 | + | # It's a good idea to reduce the OpenVPN |
- | <file conf interfaces> | + | # daemon's privileges after initialization. |
- | # This file describes the network interfaces available on your system | + | # |
- | # and how to activate them. For more information, see interfaces(5). | + | # You can uncomment this out on |
+ | # non-Windows systems. | ||
+ | #user nobody | ||
+ | #group nogroup | ||
- | # The loopback network interface | + | # The persist options will try to avoid |
- | auto lo | + | # accessing certain resources on restart |
- | iface lo inet loopback | + | # that may no longer be accessible because |
+ | # of the privilege downgrade. | ||
+ | persist-key | ||
+ | persist-tun | ||
- | auto eth0 | + | # Output a short status file showing |
- | #iface eth0 inet dhcp | + | # current connections, truncated |
- | iface eth0 inet static | + | # and rewritten every minute. |
- | address 10.0.3.100 | + | status /var/log/openvpn/openvpn-status.log |
- | netmask 255.255.255.0 | + | |
- | gateway 10.0.3.1 | + | |
- | dns-nameserver 10.0.3.1 | + | |
- | </file> | + | |
- | \\ | + | # By default, log messages will go to the syslog (or |
+ | # on Windows, if running as a service, they will go to | ||
+ | # the "\Program Files\OpenVPN\log" directory). | ||
+ | # Use log or log-append to override this default. | ||
+ | # "log" will truncate the log file on OpenVPN startup, | ||
+ | # while "log-append" will append to it. Use one | ||
+ | # or the other (but not both). | ||
+ | ;log /var/log/openvpn/openvpn.log | ||
+ | ;log-append /var/log/openvpn/openvpn.log | ||
- | 実運用に使用する場合、アカウントも変更しておいたほうが良いと思います。\\ | + | # Set the appropriate level of log |
- | 変更できたら、コンテナを停止し、バックグラウンドで起動させます。 | + | # file verbosity. |
+ | # | ||
+ | # 0 is silent, except for fatal errors | ||
+ | # 4 is reasonable for general usage | ||
+ | # 5 and 6 can help to debug connection problems | ||
+ | # 9 is extremely verbose | ||
+ | verb 3 | ||
- | <code> | + | # Silence repeating messages. At most 20 |
- | ubuntu@ubuntu:~$ sudo halt | + | # sequential messages of the same message |
- | [sudo] password for ubuntu: | + | # category will be output to the log. |
+ | ;mute 20 | ||
- | Broadcast message from ubuntu@ubuntu | + | # Notify the client that when the server restarts so it |
- | (/dev/lxc/console) at 17:35 ... | + | # can automatically reconnect. |
+ | explicit-exit-notify 1 | ||
- | The system is going down for halt NOW! | + | fragment 1426 |
- | ubuntu@ubuntu:~$ <4>init: tty4 main process (351) killed by TERM signal | + | mssfix |
- | … メッセージが続きます | + | |
</code> | </code> | ||
- | |||
- | ホストのプロンプトに戻ったら、バックグラウンドで起動させます。 | ||
- | |||
- | <code> | ||
- | root@macaron:~# lxc-start -n ubuntu -d | ||
- | </code> | ||
- | |||
- | <code> | ||
- | root@macaron:~# lxc-ls --fancy | ||
- | NAME STATE IPV4 IPV6 AUTOSTART | ||
- | -------------------------------------------- | ||
- | ubuntu RUNNING 10.0.3.100 - NO | ||
- | </code> | ||
- | |||
- | \\ | ||
- | |||
- | これ以降は、コンソールではなく SSH で接続します。 | ||
- | |||
- | <code> | ||
- | $ ssh -l ubuntu 10.0.3.100 | ||
- | The authenticity of host '10.0.3.100 (10.0.3.100)' can't be established. | ||
- | ECDSA key fingerprint is 1a:1a:6b:6c:90:99:7b:72:76:1f:b0:a3:99:92:2d:08. | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added '10.0.3.100' (ECDSA) to the list of known hosts. | ||
- | ubuntu@10.0.3.100's password: | ||
- | Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-35-generic x86_64) | ||
- | |||
- | * Documentation: https://help.ubuntu.com/ | ||
- | Last login: Tue Sep 9 17:34:04 2014 | ||
- | ubuntu@ubuntu:~$ | ||
- | </code> | ||
- | |||
- | \\ | ||
- | |||
- | ===== OpenVPN の導入 ===== | ||
- | |||