Does iOS provide any APIs that can be used to create a route statically as done in MAC OS.

We are trying to figure out a way to find an API that can programatically help adding/deleting a routing address into/from a route table.

In MAC, this operation is achieved by providing "route" commands in the terminal. Eg. route -n add -net

We make use on NE PacketTunnelProvider for creating the tun interface were we can provide IPv4 routes. However at a later point of time we need to add routes as well. Do we have any provision from iOS that can be used to create route statically as done in MAC.

Answered by DTS Engineer in 690240022

only from within the NE

Yes.

when we “Start” the VPN Tunnel

No. You must call it to start the tunnel but you can call it again to update the tunnel’s settings.

From the APP layer if I need to pass the new Route address Information (when the VPN connection is already up and running), will the current VPN connection get impacted ?

Yes, assuming that the provider applies the settings.

There are two standard ways to share state between your app and your provider:

Once your provider learns about the new configuration, it should then call setTunnelNetworkSettings(_:completionHandler:) to apply the state.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

We make use on NE packet tunnel provider for creating the tun interface were we can provide IPv4 routes. However at a later point of time we need to add routes as well.

To do this, call setTunnelNetworkSettings(_:completionHandler:) with the new settings.

You should use this technique on the Mac as well; changing the routing table behind the back of the Network Extension / System Configuration framework infrastructure is likely to cause problems.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

only from within the NE

Yes.

when we “Start” the VPN Tunnel

No. You must call it to start the tunnel but you can call it again to update the tunnel’s settings.

From the APP layer if I need to pass the new Route address Information (when the VPN connection is already up and running), will the current VPN connection get impacted ?

Yes, assuming that the provider applies the settings.

There are two standard ways to share state between your app and your provider:

Once your provider learns about the new configuration, it should then call setTunnelNetworkSettings(_:completionHandler:) to apply the state.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Does iOS provide any APIs that can be used to create a route statically as done in MAC OS.
 
 
Q