Click here to Skip to main content
15,886,535 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hi.
I've faced something difficult problem developing sample VPN APK for Android.
Via my apk, I wanna set IP and MAC address of TUN device according to user's mind so user can change IP and MAC address of TUN several times. But I don't how to set IP and MAC address of TUN device.

Well, is it possible to let the user change IP and MAC address of TUN device?
If so, How can I do it?

I really appreciate your answers. Thank you.
Posted

1 solution

In regular linux, this is pretty easy (reference[^]), in Android... well, nothing is quite as easy as it should be.

So, first off look at the permissions of /dev/net/tun and see whether you'll be able to make a tun# interface in the first place. After that, see if you'll be able to create the interface and assign it an IP address (you can do this with a simple cross-compiled C++ app, you can run as su through adb). Your final obstacle will be to see how the heck you can get permissions to do so from Java (you'll need permissions to make/open a network interface, bring up/down the interface).
 
Share this answer
 
Comments
Richard MacCutchan 18-Nov-15 4:27am    
Did you see the date of this question?
Albert Holguin 18-Nov-15 10:47am    
Not until I had already written everything down... then I said, oh well... :-/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900