Anil Anil - 1 year ago 101
Objective-C Question

How to fetch the routing table details on iOS

is there a way we can fetch routing table information on iOS? We can get network interface details surely as explained in the post. Is there a way we can utilize it to get routing table details on iOS (The MAC OSX equivalent is running the command

netstat -nr

I see the app "System Guard" doing exactly this. So there must be some app-store-approved method that allows to print the routing table.

Any help will be appreciable.

Answer Source

you can check out my repo:



  • flaw: destination property can not display netmask, for example, netstat -r sometimes would display 10.1.1/32. If you have good idea to implement the netmask, please let me know and send me a pull request.
  • sources files are:RouteTableManager.h/m and RouteRecord.h/m
  • import "RouteTableManager.h"
  • [RouteTableManager getAllRoutes] to get all routes, every route record's property is in RouteRecord.h
  • [RouteTableManager formatRouteTable] can get route table string like unix command netstat -r, e.g.

Destination Gateway Flags Refs Use Mtu Netif Expire
default UGSc 189 0 1500 en0 0 UGSc 11 0 1500 tun0 0 UH 2 0 1500 tun0 0 UGSc 1 0 1500 tun0 0 UGSc 1 0 1500 tun0 0 UHLWIi 1 1 16384 lo0 0 UGSc 1 0 1500 en0 0 link #5 UCSm 2 0 1500 en0 111 1.0.5e.0.0.fb UHLWIm 1 0 1500 en0 0 link #5 UCS 1 0 1500 en0 1343

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download