[SOLVED] DHCP on seperate Workstation for Android

As detailed on the Other VM OS page, Android requires a DHCP server to run.

Since DHCP should not be trusted I’d like to move the DHCP server to a separate Whonix Workstation rather than run it on the Gateway.

I think HulaHoop has done this in the past. I would like to know how to make this work and what settings I would need to use.

Actually what I did was find out that dhcp client on the gateway was exposed to workstations without iptables protection. It used to be that the GW needed to be dynamically assigned an IP on it’s internet facing NIC to be able to reach the outside world. We removed the package and configured the GW to work with static IPs.

You can try configuring Android to play ball with static IPs instead of having an entire setup to work around the DHCP requirement.

2 Likes

Thanks. In that case I’m unsure what IP and mask I should use here:

su
ifconfif eth0 down
ifconfig eth0 [IP] netmask [masque] up

I tried

IP: 10.152.152.12
Mask: 255.255.192.0;

but it failed.

try

10.152.152.11
255.255.255.0

Getting closer with that IP and netmask.

I’m working on a Android VM in Virtualbox which previously worked with Whonix Gateway with DHCP. I’m launching another Gateway with the other shut to test this. So at least the Virtualbox routing seems to be working.

I can see in ifconfig that eth0 is updated with inet addr and mask etc. However if I try to ping 8.8.8.8 or what I believe should be configured as the gateway, 10.152.152.10, I get network is unreachable.

I have tried adding a gateway with:

route add default gw 10.152.152.10 dev eth0

but that doesn’t work since I can’t reach 10.152.152.10 anyway.

Any ideas on how to proceed?

ping is UDP. Unsupported, details:

Tor - Whonix

Related:

Frequently Asked Questions - Whonix ™ FAQ

That makes sense thanks @Patrick.

I’m trying this all on Nougat x86 if it helps. Still no success however I did try with DHCP and record the settings which it showed:

IP: 10.152.152.12/18
Gateway: 10.152.152.10
Mask: 255.255.192.0

I tried to configure with ndc after setting the ip and mask like:

ip addr add 10.152.152.12/18 dev eth0
ifconfig eth0 down
ndc network create 10
ndc network interface add 10 eth0
ndc network route add 10 eth0 0.0.0.0/0 10.152.152.10

However that last command results in a network unreachable error. I tried after putting eth0 up too and it failed.

I have not succeeded in getting anything to work in Chrome, apart from when using DHCP.

I have noted that ip addr add... seems to be the right way to set IP in Nougat, with the previous attempts with ifconfig eth0 [IP]... not being reflected in the output of either ifconfig or ip addr.

Solved! Use the following:

su
ifconfig eth0 10.152.152.12 netmask 255.255.192.0
ip rule add from all lookup main pref 0
busybox route add default gw 10.152.152.10
ndc resolver setnetdns 100 localdomain 10.152.152.10

DNS now works.

2 Likes

Thank you for adding this here! I am sure there’ll be other users really happy about this.

Anonymize Other Operating Systems

1 Like

Thank you for your tireless work on this project. And thanks for the suggestion @HulaHoop.

I lost access to my OP account, could you please add [Solved] to the title so others know this is now possible?

1 Like

For Android 9 Pie, I had to slightly change @testTYT1’s commands (thanks a lot btw, you’re a life saver!!!) - replace eth0 with wlan0, thus:

su
ifconfig wlan0 10.152.152.12 netmask 255.255.192.0
ip rule add from all lookup main pref 0
busybox route add default gw 10.152.152.10
ndc resolver setnetdns 100 localdomain 10.152.152.10

Actually, the method I mentioned above doesn’t work reliably all - it seems to work whenever it wants.

I’ve found another solution, a much easier one - no CLI needed, it’s configured in Android itself - just go to the WiFi panel, forget “VirtWifi”, create a new WiFi connection there with the same name and a static route option (not DHCP):
ip address = 10.152.152.12
gateway 10.152.152.10
subnet 18

works flawlessly for me

1 Like

Thank you. This is great option.

I try to use Bliss OS 11.12 as Workstation for testing. Where can I set up subnet 18 here?

And what x86 Pie do you use? I could not find ungoogled totally.

Can you please submit these changes to our wiki so they can help others using more recent Android versions?

1 Like

Network prefix length = subnet (set it to 18)

I’m using the x86-64 Android

1 Like

Hello, I have already tried everything, but I can not get the Internet to work.

The last thing I stopped at was the iik user’s way of “create a new WiFi connection there with the same name and…”

I created a new wifi with the same settings:
ip address = 10.152.152.12
gateway 10.152.152.10
subnet 18
But android just can not connect to this network, what could be the problem?

Yo can use Bliss OS. I works good as workstation with Whonix Gateway.