Setting correct MTU
Posted: Mon Oct 16, 2017 2:11 pm
Hi,
I am getting used to ovpn ( and VPN in general ) little by little.
Yet I am facing an MTU issue as I frequently experience slow VPN performance, but after rebooting one end ( usually client ) the performance usually is OK after 1-3 reboots.
My goal is to have a proper configuration, so I will have a stable ( read: fast ) connection by default without the need of rebooting.
One end ( server ) has MTU of 1500, while the client's MTU size is: 1492 . My first hunch is I should use parameters like : " link-mtu, tun-mtu, mssfix and maybe more ". Therefore seeking help from community, basically what to do when MTU size on both ends differs ?
As a side note openvpn 2.4.3 and 2.4.4 is used on debian stretch platforms ( client: regular PC and server: NanoPiNEO2 )
1/
I started checking my eth0 devices ( both server and client ) and both show: "2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000"
2/
Next I check both ends with " ping -M do -c 1 -s 1472 www.yahoo.com ".
The server side reports:
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1472(1500) bytes of data.
1480 bytes from media-router-fp2.prod.media.vip.ir2.yahoo.com (188.125.80.145): icmp_seq=1 ttl=56 time=32.0 ms
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 32.023/32.023/32.023/0.000 ms
While the client fails and says:
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1472(1500) bytes of data.
From x.y.z.215 (x.y.z.215) icmp_seq=1 Frag needed and DF set (mtu = 1492)
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
The client MTU seems to be 1492 instead of 1500 and following packet size, 1464, appears to be the maximum
ping -M do -c 1 -s 1464 www.yahoo.com
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1464(1492) bytes of data.
1472 bytes from media-router-fp2.prod.media.vip.ir2.yahoo.com (188.125.80.145): icmp_seq=1 ttl=56 time=56.8 ms
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 56.838/56.838/56.838/0.000 ms
3/
Currently " ip link show dev tun0 "shows an MTU of 1500 on both ends wich looks incorrect to me:
" 3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000 "
4/
server.conf shows
log /var/log/openvpn.log
verb 4
status /var/log/openvpn-status.log 30
dev tun
local 192.168.10.11
proto udp4
port 1194
persist-key
persist-tun
keepalive 10 120
txqueuelen 1000
server 10.8.0.0 255.255.255.0
topology subnet
route 192.168.20.0 255.255.255.0
push "route 192.168.10.0 255.255.255.0"
push "dhcp-option DNS 192.168.10.10"
script-security 2
up /etc/openvpn/script/up.sh
down /etc/openvpn/script/down.sh
sndbuf 393216
rcvbuf 393216
push "sndbuf 393216"
push "rcvbuf 393216"
float
comp-lzo no #No need for streaming
fast-io #Optimize I/O writes
tls-version-min 1.2
remote-cert-tls client
tls-auth /etc/openvpn/key/ta.key 0
cipher AES-128-CBC # Nano Pi NEO2
ncp-disable
auth SHA256
client-config-dir /etc/openvpn/ccd
ca /etc/openvpn/key/pivpn01_CA.crt #ca cert
cert /etc/openvpn/key/pivpn01_SRV.crt
key /etc/openvpn/key/pivpn01_SRV.pem
dh /etc/openvpn/key/dh2048.pem
5/ client.conf
log /var/log/openvpn.log
verb 4
client
dev tun
proto udp4
remote someaddress.dynu.net someport
resolv-retry infinite
nobind
persist-key
persist-tun
keepalive 10 120
txqueuelen 1000
script-security 2
up /etc/openvpn/script/up.sh
down /etc/openvpn/script/down.sh
explicit-exit-notify 2
float
comp-lzo no
fast-io
tls-version-min 1.2
remote-cert-tls server
verify-x509-name pivpn01_SRV name
cipher AES-128-CBC
auth SHA256
ca /etc/openvpn/key/pivpn01_CA.crt
cert /etc/openvpn/key/npi2-02.crt
key /etc/openvpn/key/npi2-02.pem
dh /etc/openvpn/key/ta.key 1
I am getting used to ovpn ( and VPN in general ) little by little.
Yet I am facing an MTU issue as I frequently experience slow VPN performance, but after rebooting one end ( usually client ) the performance usually is OK after 1-3 reboots.
My goal is to have a proper configuration, so I will have a stable ( read: fast ) connection by default without the need of rebooting.
One end ( server ) has MTU of 1500, while the client's MTU size is: 1492 . My first hunch is I should use parameters like : " link-mtu, tun-mtu, mssfix and maybe more ". Therefore seeking help from community, basically what to do when MTU size on both ends differs ?
As a side note openvpn 2.4.3 and 2.4.4 is used on debian stretch platforms ( client: regular PC and server: NanoPiNEO2 )
1/
I started checking my eth0 devices ( both server and client ) and both show: "2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000"
2/
Next I check both ends with " ping -M do -c 1 -s 1472 www.yahoo.com ".
The server side reports:
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1472(1500) bytes of data.
1480 bytes from media-router-fp2.prod.media.vip.ir2.yahoo.com (188.125.80.145): icmp_seq=1 ttl=56 time=32.0 ms
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 32.023/32.023/32.023/0.000 ms
While the client fails and says:
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1472(1500) bytes of data.
From x.y.z.215 (x.y.z.215) icmp_seq=1 Frag needed and DF set (mtu = 1492)
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
The client MTU seems to be 1492 instead of 1500 and following packet size, 1464, appears to be the maximum
ping -M do -c 1 -s 1464 www.yahoo.com
PING atsv2-fp.wg1.b.yahoo.com (188.125.80.145) 1464(1492) bytes of data.
1472 bytes from media-router-fp2.prod.media.vip.ir2.yahoo.com (188.125.80.145): icmp_seq=1 ttl=56 time=56.8 ms
--- atsv2-fp.wg1.b.yahoo.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 56.838/56.838/56.838/0.000 ms
3/
Currently " ip link show dev tun0 "shows an MTU of 1500 on both ends wich looks incorrect to me:
" 3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000 "
4/
server.conf shows
log /var/log/openvpn.log
verb 4
status /var/log/openvpn-status.log 30
dev tun
local 192.168.10.11
proto udp4
port 1194
persist-key
persist-tun
keepalive 10 120
txqueuelen 1000
server 10.8.0.0 255.255.255.0
topology subnet
route 192.168.20.0 255.255.255.0
push "route 192.168.10.0 255.255.255.0"
push "dhcp-option DNS 192.168.10.10"
script-security 2
up /etc/openvpn/script/up.sh
down /etc/openvpn/script/down.sh
sndbuf 393216
rcvbuf 393216
push "sndbuf 393216"
push "rcvbuf 393216"
float
comp-lzo no #No need for streaming
fast-io #Optimize I/O writes
tls-version-min 1.2
remote-cert-tls client
tls-auth /etc/openvpn/key/ta.key 0
cipher AES-128-CBC # Nano Pi NEO2
ncp-disable
auth SHA256
client-config-dir /etc/openvpn/ccd
ca /etc/openvpn/key/pivpn01_CA.crt #ca cert
cert /etc/openvpn/key/pivpn01_SRV.crt
key /etc/openvpn/key/pivpn01_SRV.pem
dh /etc/openvpn/key/dh2048.pem
5/ client.conf
log /var/log/openvpn.log
verb 4
client
dev tun
proto udp4
remote someaddress.dynu.net someport
resolv-retry infinite
nobind
persist-key
persist-tun
keepalive 10 120
txqueuelen 1000
script-security 2
up /etc/openvpn/script/up.sh
down /etc/openvpn/script/down.sh
explicit-exit-notify 2
float
comp-lzo no
fast-io
tls-version-min 1.2
remote-cert-tls server
verify-x509-name pivpn01_SRV name
cipher AES-128-CBC
auth SHA256
ca /etc/openvpn/key/pivpn01_CA.crt
cert /etc/openvpn/key/npi2-02.crt
key /etc/openvpn/key/npi2-02.pem
dh /etc/openvpn/key/ta.key 1