Posts

Post not yet marked as solved
1 Replies
1k Views
I have set up a NEPacketTunnelProvider and am able to successfully execute the startTunnelWithOptions:completionHandler:method. The VPN is installed and I can see the [VPN] indicator in the top bar.I am reading packets like this:privatefunc readPacketObjects() { self.packetFlow.readPacketObjects() { packets in for packet in packets { do { let ipPacket = try IPPacket.init(data: packet.data) NSLog(">>>>>>>>> \(ipPacket.sourceIp)") NSLog(">>>>>>>>> \(ipPacket.destinationIp)") NSLog(">>>>>>>>> \(ipPacket.proto)") NSLog(">>>>>>>>> \(ipPacket.version)") } catch { NSLog(">>>>>>>>> Error: \(error)") } } self.packetFlow.writePacketObjects(packets) self.readPacketObjects() } }I wrote a simple packet parser to get a better understanding of the data being read from readPacketObjects.It turns out that I'm only getting (and only occasionally) TCP traffic with source 127.0.0.1 and destination 50.17.39.244. The network extension does look like it's blocking all of my outbound network traffic, as I can't use the web browser when the VPN is active.As my background is not in networking, I feel like I'm mainly guessing with the configuration. Here's what I've got so far: let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "some address") settings.tunnelOverheadBytes = 80 settings.mtu = 1500 settings.ipv4Settings = NEIPv4Settings(addresses: ["127.0.0.1", "0.0.0.0"], subnetMasks: ["0.0.0.0", "0.0.0.0"]) // all addresses settings.ipv4Settings?.includedRoutes = [NEIPv4Route.default()] // all routes settings.ipv4Settings?.excludedRoutes = [NEIPv4Route(destinationAddress: "127.0.0.1", subnetMask: "255.255.255.255")] // avoid local routes settings.dnsSettings = NEDNSSettings(servers: ["8.8.8.8", "8.8.4.4"])Do you have any thoughts on why I can only see packets that are headed towards 50.17.39.244?
Posted
by rkotcher.
Last updated
.