LoginSignup
13
11

More than 5 years have passed since last update.

MacでVPN接続のMTU値を自動設定する

Last updated at Posted at 2014-06-19

VPN接続時のMTU値のデフォルトは1500のため、環境によっては正常にパケットが到達しません。
自動的にMTU値とついでにルーティングが設定されるようにします。

How to

  1. /etc/ppp/ip-up を作成します。

    $ sudo vi /etc/ppp/ip-up
    $ cat /etc/ppp/ip-up
    #!/bin/bash
    #
    # Script which handles the routing issues as necessary for pppd
    # Only the link to Newman requires this handling.
    #
    # When the ppp link comes up, this script is called with the following
    # parameters
    #       $1      the interface name used by pppd (e.g. ppp3)
    #       $2      the tty device name
    #       $3      the tty device speed
    #       $4      the local IP address for the interface
    #       $5      the remote IP address
    #       $6      the parameter specified by the 'ipparam' option to pppd
    #
    case "$5" in
        <接続先のIPアドレス>)
            /sbin/ifconfig $1 mtu 1300
            /sbin/route -nv add -net 192.168.0.0/24 -interface $1
            ;;
        *)
            ;;
    esac
    exit 0
    # EOF
    

    接続先のIPアドレスはVPN接続後にifconfigで確認できます。

  2. 実行権限を付けます。

    $ sudo chmod a+x /etc/ppp/ip-up
    

後は、VPNに接続すると自動的に設定されます。


参考

13
11
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
13
11