I've implemented a custom VPN using NEPacketTunnelProvider. But I found that if MTU is set to 1500, most sites on internet cannot access via VPN. If I change MTU to 1000, all sites seems to work except for some video share site (e.g. videomega.tv )
Here's my code:
NEPacketTunnelNetworkSettings *settings = [[NEPacketTunnelNetworkSettings alloc] initWithTunnelRemoteAddress:vpnServerIP];
settings.IPv4Settings = [[NEIPv4Settings alloc] initWithAddresses:addresses subnetMasks:subnetMasks];
NEIPv4Route *defaultRoute = [NEIPv4Route defaultRoute];
NEIPv4Route *localRoute = [[NEIPv4Route alloc] initWithDestinationAddress:localGW subnetMask:gwNetMask];
settings.IPv4Settings.includedRoutes = @[defaultRoute, localRoute];
settings.IPv4Settings.excludedRoutes = someIPs;
settings.DNSSettings = [[NEDNSSettings alloc] initWithServers:dnsServers];
//what exactly number should I set here?
settings.MTU = [NSNumber numberWithInt:1000];
[self setTunnelNetworkSettings:settings completionHandler:^(NSError * _Nullable error)
My question is:
What's the "best" MTU number should I use in NEPacketTunnelProvider, to access all internet sites?