opensshをつかった簡易VPN (2) /etc/sshd/sshd_configの編集

サーバ側(とりあえず38ね)の/etc/ssh/sshd_config (ssh_configではないのよ)
のPermitTunnel 項目の追加


tunデバイスの転送を許可するかどうかを指定する。

デフォルトはno。

point-to-point.. layer3(tun)
ethernet .. layer 2(tap)

yesを指定すると上記2設定の両方を許可したことになる。


サーバ側の設定が終わったら、sshdをリスタートして、
クライアント側(39)から次のようにする

deb505-64-39:~/.ssh# ssh -v -w0:0 192.168.1.38
OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.38 [192.168.1.38] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.38' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: Requesting tun unit 0 in mode 1
debug1: sys_tun_open: tun0 mode 1 fd 4
debug1: channel 0: new [tun]
debug1: channel 1: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Server has rejected tunnel device forwarding
channel 0: open failed: administratively prohibited: open failed
debug1: channel 0: free: tun, nchannels 2
debug1: Sending environment.
debug1: Sending env LANG = ja_JP.UTF-8
Linux deb505-64-38 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Feb  7 19:27:44 2011 from 192.168.1.17
deb505-64-38:~# 

む、38には接続できたみたいだけど、次のエラーがでたよ。
debug1: Remote: Server has rejected tunnel device forwarding
channel 0: open failed: administratively prohibited: open failed

このdebiankvmが走っている関係上、すでにbr0があるですよ。

deb505-64-38:~# brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.18a905553f88	no		eth0
deb505-64-38:~# ip addr br0
Command "br0" is unknown, try "ip addr help".
deb505-64-38:~# 
deb505-64-38:~# ip addr
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 18:a9:05:55:3f:88 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::1aa9:5ff:fe55:3f88/64 scope link 
       valid_lft forever preferred_lft forever
3: br0:  mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether 18:a9:05:55:3f:88 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.38/24 brd 192.168.1.255 scope global br0
    inet6 2001:c90:ea4:3011:2ff:5eff:fe53:46b8/64 scope global dynamic 
       valid_lft 2508318sec preferred_lft 521118sec
    inet6 2001:c90:ea4:3011:2ff:4bff:fe18:7a78/64 scope global dynamic 
       valid_lft 2331005sec preferred_lft 343805sec
    inet6 2001:c90:ea4:3011:2ff:64ff:feee:d765/64 scope global dynamic 
       valid_lft 2164531sec preferred_lft 177331sec
    inet6 2001:c90:ea4:3011:1aa9:5ff:fe55:3f88/64 scope global dynamic 
       valid_lft 2591961sec preferred_lft 604761sec
    inet6 fe80::1aa9:5ff:fe55:3f88/64 scope link 
       valid_lft forever preferred_lft forever
deb505-64-38:~# 

すでによくわからん。つぎ(centos)にいってみよ。