From owner-FreeBSD-net-jp@jp.FreeBSD.org Mon Jul 29 18:57:01 2002
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id g6T9v1m10181;
	Mon, 29 Jul 2002 18:57:01 +0900 (JST)
	(envelope-from owner-FreeBSD-net-jp@jp.FreeBSD.org)
Received: from athena.ginganet.org (postfix@tk0008-202x210x243x26.ap-TK.usen.ad.jp [202.210.243.26])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id g6T9v1n10176
	for <FreeBSD-net-jp@jp.FreeBSD.org>; Mon, 29 Jul 2002 18:57:01 +0900 (JST)
	(envelope-from ginga@ginganet.org)
Received: by athena.ginganet.org (Postfix, from userid 5003)
	id EF73A3E26; Mon, 29 Jul 2002 18:57:00 +0900 (JST)
Date: Mon, 29 Jul 2002 18:57:00 +0900
From: Kawaguti Ginga <ginga-freebsd@ginganet.org>
To: FreeBSD-net-jp@jp.FreeBSD.org
Message-ID: <20020729095700.GC716%ginga-freebsd@ginganet.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Disposition: inline
User-Agent: Mutt/1.3.27i-ja.2
Reply-To: FreeBSD-net-jp@jp.FreeBSD.org
Precedence: list
X-Sequence: FreeBSD-net-jp 3763
Subject: [FreeBSD-net-jp 3763] vtund =?ISO-2022-JP?B?GyRCJEdETBsoQg==?=
 =?ISO-2022-JP?B?GyRCPm8kThsoQg==?= IP address
 =?ISO-2022-JP?B?GyRCJEskaCRrQFxCMxsoQg==?=(unnumbered
 routing?)
Errors-To: owner-FreeBSD-net-jp@jp.FreeBSD.org
Sender: owner-FreeBSD-net-jp@jp.FreeBSD.org
X-Originator: ginga-freebsd@ginganet.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+020727

$B@n8}$G$9(B

vtun $B$K$h$k(B 2$BBf$N(B FreeBSD PC $B4V$N(B VPN $B$r(B
$BD%$m$&$H$7$F$$$k$N$G$9$,!$$I$&$b>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j$$CW$7$^$9!%(B


$B%M%C%H%o!<%/9=@.$O(B

192.168.0.0/24 ______________________________ (ether)
    			|		|
		192.168.0.72	192.168.0.77
		(server)	(client)
$B$G$9!%(B

____________________________________________________________
# server(192.168.0.72) $B$N(B vtund.conf:
options {
  port 5000;            # Listen on this port.
  ppp           /usr/sbin/pppd;
  ifconfig      /sbin/ifconfig;
  route         /sbin/route;
}
default {
  compress no;          # Compression is off by default   
  speed 0;              # By default maximum speed, NO shaping
}
ariontest {
  pass  ariontest;              # Password
  type  tun;            # IP tunnel
  proto udp;            # UDP protocol
  encr  yes;            # Encryption
  keepalive yes;        # Keep connection alive

  srcaddr {
    addr 192.168.0.72;
  };
  up {
        ifconfig "%d add %A %a netmask 255.255.255.255";
        route "add -host %a -interface %%";
  };
  down {
        ifconfig "%% delete down";
        #route "delete -host %a";
  };
}
____________________________________________________________
#client(192.168.0.77) $B$N(B vtund.conf:

options {
  port 5000;		# Connect to this port.
  timeout 60;		# General timeout
  ifconfig	/sbin/ifconfig;
  route		/sbin/route;
}

ariontest {
  pass ariontest;
  srcaddr {
    addr 192.168.0.77;
  };
  up {
    ifconfig "%d add %A %a netmask 255.255.255.255";
    route "add -host %a -interface %%";
  };
  down {
    ifconfig "%% delete down";
    #route "delete -host %a";
  };
}
____________________________________________________________

$B$5$F!$$=$3$G(B vtun $B$r5/F0$7$F$_$^$9!%(B
server# vtund -n -s
vtund[23126]: VTUN server ver 2.5 06/28/2002 (stand)		#$B5/F0;~(B
vtund[23127]: Session ariontest[192.168.0.77:1040] opened	# client $B@\B3(B
vtund[23127]: UDP connection initialized
vtund[23127]: BlowFish encryption initialized
route: writing to routing socket: File exists
add host 192.168.0.77: gateway tun0: File exists
vtund[23127]: Permission denied (13)		# $B$7$P$i$/(B(10$BICDxEY(B?)$B$7$F(B
vtund[23127]: Session ariontest closed		# $B$3$N(B2$B9T$,$G$k(B


$B%/%i%$%"%s%HB&$O(B 
client# vtund -n ariontest 192.168.0.72
vtund[281]: VTun client ver 2.5 06/30/2002 started
vtund[281]: Connecting to 192.168.0.72
vtund[281]: Session ariontest[192.168.0.72] opened
vtund[281]: UDP connection initialized
vtund[281]: BlowFish encryption initialized
route: writing to routing socket: File exists
add host 192.168.0.72: gateway tun0: File exists

$B$H$J$C$F$$$^$9!%$J$*!$(Bnice -19 $B$G$J$K$+!$(B
$B4V0c$C$?%]!<%j%s%0$r$7$F$$$k$N$+!$(B
CPU 99% $B%V%s2s$7$F$/$l$F$$$^$9!%(B


$B$G!$(Bserver $BB&$G(B permission denied $B$,$G$kA0$N;~$K(B
server# ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
        inet6 fe80::210:4bff:fe2c:57b5%tun0 prefixlen 64 scopeid 0x8 
        inet 192.168.0.72 --> 192.168.0.77 netmask 0xffffffff 
        Opened by PID 23146
server# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            xxx.xx.xx.xxx      UGSc       14        0    dc0
127.0.0.1          127.0.0.1          UH          5     1526    lo0
192.168.0          link#1             UC          2        0    xl0
192.168.0.72       00:10:4b:2c:57:b5  UHLW        3     1114    lo0
192.168.0.77       192.168.0.72       UH          0        0   tun0

$B$H$J$C$F$$$^$9!%(Bnet-jp:3130 $B$NEj9F$H$O$J$s$+0c$$$^$9$h$M(B...

denied $B0J9_$O(B

server# ifconfig tun0
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
        inet6 fe80::210:4bff:fe2c:57b5%tun0 prefixlen 64 scopeid 0x8 
netstat -rn $B$O(B
192.168.0          link#1             UC          1        0    xl0
192.168.0.72       00:10:4b:2c:57:b5  UHLW        3     1114    lo0


$B$J$s$H$J$/!$(Btun device + vtun $B$J@\B3$O=PMh$F$$$k$1$l$I!$(B
ifconfig/route $B$N=q$-J}$G$&$^$/7R$,$i$J$$!$$h$&$J5$$b$7$^$9$7!$(B
$B$7$P$i$/$9$k$H(B tun $B$,>C$($F$7$^$&$N$G!$$=$l0JA0$N$h$&$J5$$b$7$^$9(B...
-- 
       $B"J"J(B
Zzz.. (- - )$B"^"^"=!A(B           $B@n8}(B $B6d2O(B
      ##############   ginga-freebsd@ginganet.org
