通过VPN网关路由局域网流量

时间:2019-09-05 07:08:48

标签: vpn

我的iMac具有连接到远程VPN的软件。它运作良好-但仅适用于该特定设备。

我现在想允许网络上的其他设备通过iMac访问相同的VPN连接。这样做的原因是因为我的手机无法连接到VPN本身,因为它不支持OpenVPN协议。

我已启用了sqlite

的端口转发

我尝试将以下内容添加到class ProjectCoreDataStore: DegreesProtocol, DegreesStoreUtilityProtocol { // MARK: - Managed object contexts var mainManagedObjectContext: NSManagedObjectContext var privateManagedObjectContext: NSManagedObjectContext // MARK: - Object lifecycle init() { // This resource is the same name as your xcdatamodeld contained in your project. guard let modelURL = Bundle.main.url(forResource: "myDB", withExtension: "momd") else { fatalError("Error loading model from bundle") } // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. guard let mom = NSManagedObjectModel(contentsOf: modelURL) else { fatalError("Error initializing mom from: \(modelURL)") } let psc = NSPersistentStoreCoordinator(managedObjectModel: mom) mainManagedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) mainManagedObjectContext.persistentStoreCoordinator = psc let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) let docURL = urls[urls.endIndex-1] /* The directory the application uses to store the Core Data store file. This code uses a file named "DataModel.sqlite" in the application's documents directory. */ let storeURL = docURL.appendingPathComponent("myDB.sqlite") do { try psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: storeURL, options: nil) } catch { fatalError("Error migrating store: \(error)") } privateManagedObjectContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) privateManagedObjectContext.parent = mainManagedObjectContext } deinit { do { try self.mainManagedObjectContext.save() } catch { fatalError("Error deinitializing main managed object context") } } func myQuery(){ ........ } } 文件的第32行中:sysctl -w net.inet.ip.forwarding=1,其中en0是来自互联网的我的以太网端口,而utun1是vpn出现时所有流量的地方已连接

运行/etc/pf.conf时出现错误

  

/etc/pf.conf:32:规则必须井井有条:选项,规范化,   排队,翻译,过滤pfctl:配置文件中的语法错误:   pf规则未加载

谁能告诉我为什么我会收到此错误?我是否使用了nat命令?

0 个答案:

没有答案