iBook G4, Vine Linux 4.2 / OpenVPN設定その1


ifconfig, openvpnコマンドにパスを通す。

# vi /etc/bachrc
~~~
export PATH=/sbin:/usr/sbin:$PATH #追加
~~~


varの編集から証明書の発行まで。

# cd /etc/openvpn/easy-rsa
# vi vars
export KEY_COUNTRY=JP
export KEY_PROVINCE=Saitama
export KEY_CITY=Kawagoe
export KEY_ORG="saitoh-online.plala.jp"
export KEY_EMAIL="dsaitoh+openvpn@gmail.com"

# chmod +x vars
# chmod +x clean-all
# chmod +x build-ca
# . ./vars
# ./clean-all
# ./build-ca
~~~
Common Name (eg, your name or your server's hostname) []:OPEN_VPN #入力
~~~
# chmod +x build-key-server
# ./build-key-server server
~~~
Common Name (eg, your name or your server's hostname) []:OPEN_VPN #入力
~~~
Sign the certificate? [y/n]:y #入力


1 out of 1 certificate requests certified, commit? [y/n]y #入力
Write out database with 1 new entries
Data Base Updated

# chmod +x build-dh
# ./build-dh
--++++---~~~

# chmod +x build-key-pass
# ./build-key-pass client1
~~~
Enter PEM pass phrase: #パスワード入力
Verifying - Enter PEM pass phrase: #パスワード入力
~~~
Common Name (eg, your name or your server's hostname) []:client1 #入力
~~~
Sign the certificate? [y/n]:y #入力


1 out of 1 certificate requests certified, commit? [y/n]y #入力
Write out database with 1 new entries
Data Base Updated

# ls keys
01.pem  ca.key       client1.key  index.txt.attr      serial      server.csr
02.pem  client1.crt  dh1024.pem   index.txt.attr.old  serial.old  server.key
ca.crt  client1.csr  index.txt    index.txt.old       server.crt


server.confの編集。

# cp ~/openvpn-2.0.9/sample-config-files/server.conf /etc/openvpn/
# vi /etc/openvpn/server.conf
(ブリッジ方式設定を入力。)


ネットワークアダプタの設定。

# echo 1 > /proc/sys/net/ipv4/ip_forward
# vi /etc/sysctl.conf
~~~
# Controls IP packet forwarding
net.ipv4.ip_forward = 1 #変更
~~~


起動スクリプトの用意。

# cp /home/dsaitoh/openvpn-2.0.9/sample-scripts/* /etc/openvpn/
# vi /etc/openvpn/bridge-start
(ブリッジ方式設定を入力。)


Synapticパッケージマネージャを利用して、bridge-utils, bridge-utils-devel をインストールする。


そしてブリッジ起動。

# cd /etc/openvpn
# ./bridge-start

そしたら「Device or resource busy (errno=16)」と出て tap0 が使えないよう。


寒いし眠いので今日はここまで。