ZestyZest
ZestyZest

Reputation: 951

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.

Upvotes: 2

Views: 7582

Answers (2)

jianpx
jianpx

Reputation: 3330

you can check out my repo: https://github.com/jianpx/ios-cabin/tree/master/RouteTableManager

Description:

RouteTableManager

  • 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 10.250.174.1 UGSc 189 0 1500 en0 0
10.62.0.0 10.62.2.35 UGSc 11 0 1500 tun0 0
10.62.2.35 10.62.2.35 UH 2 0 1500 tun0 0
10.63.23.0 10.62.0.1 UGSc 1 0 1500 tun0 0
10.63.58.0 10.62.0.1 UGSc 1 0 1500 tun0 0
10.250.174.135 b8.e8.56.6.be.38 UHLWIi 1 1 16384 lo0 0
218.107.55.89 10.250.174.1 UGSc 1 0 1500 en0 0
224.0.0.0 link #5 UCSm 2 0 1500 en0 111
224.0.0.251 1.0.5e.0.0.fb UHLWIm 1 0 1500 en0 0 255.255.255.255 link #5 UCS 1 0 1500 en0 1343

Upvotes: 2

Helper99999923
Helper99999923

Reputation: 1

An option would be to decompile System Guard to get the command.

Upvotes: -1

Related Questions