Code Block swift let networkSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "240.240.240.240") networkSettings.ipv4Settings = NEIPv4Settings(addresses: ["240.0.0.1"], subnetMasks: ["255.0.0.0"]) networkSettings.ipv4Settings?.includedRoutes = [NEIPv4Route(destinationAddress: "0.0.0.0", subnetMask: "0.0.0.0")] networkSettings.ipv4Settings?.excludedRoutes = [ NEIPv4Route(destinationAddress: "240.0.0.0", subnetMask: "255.0.0.0"), NEIPv4Route(destinationAddress: "1.1.1.1", subnetMask: "255.255.255.255"), NEIPv4Route(destinationAddress: "1.0.0.1", subnetMask: "255.255.255.255") ] networkSettings.dnsSettings = NEDNSSettings(servers: ["1.1.1.1", "1.0.0.1"])
The DNS servers are set to 1.1.1.1 and 1.0.0.1 which technically should be excluded from the tunnel. But when I'm debugging, I can still see the IP packets whose destination address is 1.1.1.1/1.0.0.1 and protocol is 17(UDP) are captured by the tunnel thus DNS queries fail.
Does anybody know if I'm setting up the DNS the wrong way? Why are DNS server addresses not excluded from tunnel despite being set so?