1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SoftetherVPN の Client を Raspberry Pi で使った時の不具合対策

Last updated at Posted at 2019-12-12

以下のように、192.168.30.13 というアドレスが取得できているとします。

$ ip addr show vpn_tun0
4: vpn_tun0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 5e:e2:7a:c5:d9:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.30.13/24 brd 192.168.30.255 scope global vpn_tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::5ce2:7aff:fec5:d9d6/64 scope link 
       valid_lft forever preferred_lft forever

ルーティングテーブルが次のようになると、VPN の他の端末に ping が通りません。

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irt
t Iface
0.0.0.0         192.168.30.1    0.0.0.0         UG        0 0          0 vpn_tun0
0.0.0.0         192.168.8.1     0.0.0.0         UG        0 0          0 wlan0
192.168.8.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
192.168.30.0    0.0.0.0         255.255.255.0   U         0 0          0 vpn_tun0

次のコマンドで解決します。

# route del -net 0.0.0.0 gw 192.168.30.1 netmask 0.0.0.0

修正後のルーティングテーブル

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.8.1     0.0.0.0         UG        0 0          0 wlan0
192.168.8.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
192.168.30.0    0.0.0.0         255.255.255.0   U         0 0          0 vpn_tun0

こうなれば、VPN の他の端末に ping が通ります。

$ ping -c 3 192.168.30.10
PING 192.168.30.10 (192.168.30.10) 56(84) bytes of data.
64 bytes from 192.168.30.10: icmp_seq=1 ttl=64 time=126 ms
64 bytes from 133.130.124.85: icmp_seq=1 ttl=128 time=126 ms (DUP!)
64 bytes from 192.168.30.10: icmp_seq=2 ttl=64 time=84.4 ms
64 bytes from 133.130.124.85: icmp_seq=2 ttl=128 time=84.5 ms (DUP!)
64 bytes from 192.168.30.10: icmp_seq=3 ttl=64 time=91.9 ms

起動時に、このコマンドを実行するようにするには、
Raspberry Pi に SoftEther_VPN Client をインストール
で作成した、/opt/vpnclient/dhclient_start.sh を次のように修正します。

/opt/vpnclient/dhclient_start.sh
#
#       dhclient_start.sh
#
#                                       Dec/17/2019
sleep 10
#
/opt/vpnclient/vpncmd /client localhost /cmd AccountConnect tun0
#
sleep 1
#
dhclient vpn_tun0
#
for it in {1,2,3}
do
        sleep 20
        route del -net 0.0.0.0 gw 192.168.30.1
done
#
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?