i wanna get router ip address,i got code for how to get ip address but i didn't get router ip address(Ex: 20.30.40.01 like that).any one know please ping me..
Asked
Active
Viewed 863 times
-3
-
Are you looking for the router's internal IP address (the LAN address and your device's gateway), or the external IP address (the WAN address)? – Carsten Hansen Aug 17 '15 at 06:41
-
http://imgur.com/WvD44Af – Tamil Selvan R Aug 17 '15 at 06:45
-
see about image i wanna that router address... – Tamil Selvan R Aug 17 '15 at 06:45
-
I'm not sure, but it sounds like using the user's IP address for an iOS app *may* be against Apple's terms. If not you may have to ask permission first – Jojodmo Aug 17 '15 at 06:45
-
Also, your question will most likely be closed if you don't edit in more. So, what have you tried and why doesn't it work? What *exactly* are you looking for? – Jojodmo Aug 17 '15 at 06:47
-
is it possible to convert ip address to router address??becz end of should be 1 that is router address – Tamil Selvan R Aug 17 '15 at 06:48
-
see the image i wanna that router ip address: http://imgur.com/WvD44Af – Tamil Selvan R Aug 17 '15 at 06:49
-
programmatically i can do as a ip address programmatically but i can't get router ip address programmatically – Tamil Selvan R Aug 17 '15 at 06:50
3 Answers
0
If you want the external address:
curl -4 ifconfig.co
curl -6 ifconfig.co
If you want the internal address:
Check if your code also returns the gateway
, that's the routers internal address

Martin
- 2,754
- 1
- 15
- 35
-
-
-
see the image i wanna that router ip address: http://imgur.com/WvD44Af – Tamil Selvan R Aug 17 '15 at 06:46
0
Follow the below steps:- 1)Go to Settings 2)Network 3)Advanced 4)Select TCP/IP tab You will get IP address of MAC.

poojathorat
- 1,200
- 2
- 9
- 19
-
-
http://stackoverflow.com/questions/7072989/iphone-ipad-osx-how-to-get-my-ip-address-programmatically refer this link – poojathorat Aug 17 '15 at 06:44
-
see the image i wanna that router ip address: http://imgur.com/WvD44Af – Tamil Selvan R Aug 17 '15 at 06:46
-
https://developer.apple.com/library/mac/samplecode/GetPrimaryMACAddress/Introduction/Intro.html refer this link – poojathorat Aug 17 '15 at 06:57
-
thats showed mac ip address but i wanna that like 20.30.40.1 like router address – Tamil Selvan R Aug 17 '15 at 06:59
-1
Your local network router is always at 192.168.1.1 it plays the role of "machine 1" on the local network, or the last 1 in 192.168.1."1"
In the event this is not typically default, and to program it into your application I would refer to the code in this posting: (How can I determine the default gateway on iPhone?)
open up terminal, type:
- scutil
- list (Lists all your settings)
- show State:/Network/Global/DNS
- Terminal should read "192.168.1.1" or other primary connection(router ip)
- Should be able to script that and include it into your apps. :)
Happy Coding Ahead!

Community
- 1
- 1

Mike Horstmann
- 580
- 2
- 9
-
-
1That might be true for home routers in default configuration but there are networks where the router is not the first host in a subnet. – Martin Aug 17 '15 at 06:39
-
ok but i wanna router ip address i got ip address but i can't router ip – Tamil Selvan R Aug 17 '15 at 06:40
-
see the image i wanna that router ip address: http://imgur.com/WvD44Af – Tamil Selvan R Aug 17 '15 at 06:46
-
could u say what is this #include "getgateway.h" becz while using in the Xcode it showing error – Tamil Selvan R Aug 17 '15 at 06:51