Setup Static IP for Android 4.3 on VirtualBox

Sucata Mihnea picture Sucata Mihnea · Dec 9, 2013 · Viewed 7.7k times · Source

I am using Android 4.3 on VirtualBox, for testing apps. However, I'm running the VM on my computer, which is behind a proxy (without DHCP), so I cannot connect to the Internet from the VM.

What I need to accomplish:

  1. Setup the Android machine to use a static IP (192.168.1.213/24, with gateway 192.168.1.1)
  2. Setup proxy access (proxy is on another server in the network 192.168.1.2 and has user/pass)

Can you please let me know how I can do this? More details on what I'm using:

Not very familiar with available commands in adb (I just know that you can access it with Alt-F1, and hide it with Alt-F7), so I would appreciate more in-detail instructions.

Thank you

Edit: I ran the following commands to setup static IP:

- su

- ifconfig eth0 192.168.1.213 netmask 255.255.255.0 up

- route add default gw 192.168.1.1 dev eth0

This solved requirement 1 (setting up static IP), and now I can ping other computers from my network, so I only need a way to setup a proxy with user/pass (requirement 2)

Answer

Bishan picture Bishan · Sep 19, 2014

This article about Android x86: setting-up IP Address using command line may helpful to you.

Proxy setup

sqlite3 /data/data/com.android.providers.settings/databases/settings.db
INSERT INTO system VALUES(99, 'http_proxy', '<proxy_server>:<port>');
ex: INSERT INTO system VALUES(99, 'http_proxy', '192.168.179.202:3128');