Rooted Mobile Phone connected to a Wifi, it's usb tethered to a PC, how can i host a public minecraft java server in this PC? is it even possible?
In my wifi router, the phone's internal IP is 192.168.0.152
. I am hosting through port 6666
so i port-forwarded port 6666
to the host 192.168.0.152
in my wifi router.
In my phone, connected with adb shell
, ifconfig
wlan0 Link encap:Ethernet HWaddr 64:CC:2E:27:1B:90
inet addr:192.168.0.152 Bcast:192.168.0.255 Mask:255.255.255.0
rndis0 Link encap:Ethernet HWaddr 06:8D:91:A9:95:3C
inet addr:192.168.42.129 Bcast:192.168.42.255 Mask:255.255.255.0
In my PC (Ubuntu 20.04), ifconfig
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.42.146 netmask 255.255.255.0 broadcast 192.168.42.255
Minecraft's server.properties
, only two entries were edited, others are kept default
query.port=6666
server-port=6666
I tried the rooted solution provided in this answer
https://android.stackexchange.com/a/207342 which uses iptables
For my case i typed:
echo 1 >/proc/sys/net/ipv4/ip_forward
iptables -t nat -I PREROUTING -p tcp --dport 6666 -j DNAT --to 192.168.42.146
iptables -I FORWARD -p tcp -d 192.168.42.146 --dport 6666 -j ACCEPT
Finally i ran the server on my PC, and i was only able to connect to it via 192.168.42.146:6666
{PUBLIC_IP}:6666
was unable to connect and the error are like the following
Thanks for helping!
Pictures about "Rooted Mobile Phone connected to a Wifi, it's usb tethered to a PC, how can i host a public minecraft java server in this PC? is it even possible?"
How to Get Free Wifi Tether on Rooted Android using XTether App!
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Karolina Grabowska, Steve Johnson, Skylar Kang, Anete Lusina