I am using android emulator on windows. The android developer doc says that each instance of the emulator runs behind a virtual router/firewall service. The virtual router for each instance manages the 10.0.2/24 network address space . However, when I connect to the emulator with adb shell and do ifconfig, I got the following output:
radio0 Link encap:UNSPEC
inet addr:192.168.200.2 Bcast:192.168.200.255 Mask:255.255.255.0
wlan0 Link encap:UNSPEC
inet addr:192.168.232.2 Bcast:192.168.239.255 Mask:255.255.248.0
ip route show gives me the following output
192.168.200.0/24 dev radio0 proto kernel scope link src 192.168.200.2
192.168.232.0/21 dev wlan0 proto kernel scope link src 192.168.232.2
I do not see any of the 10.2.x.x ip address. Where are those ip address?
Also does the virtual router run within the emulator (on the Android OS) or run on windows? How to exam the virtual router?
I have the same issue running Android 7.1.1 (API 25) on Windows.
But when I emulating Android 7.0 (API 24) it works as expected. Device gets IP 10.0.2.15. In this case ip route show will bring 10.2.x.x address. So, if you can just use prior versions (API 16 - API 24).
This router exists inside emulator and Windows is not aware about it.
If you need to access service running inside emulator from Windows, you need to add port mappings:
telnet localhost 5554
auth <token from 'C:\Users\{user}\.emulator_console_auth_token'>
redir add tcp:8080:8080
Then you can access your service by: 127.0.0.1:8080. However, this approach does not work with Android 7.1.1. I have no ideas what is wrong with it.
It appears that since API 25, the networking of an emulator has changed. The device IP is no longer 10.0.2.15, and issuing a 'redir' command via telnet, as it is documented, no longer work.
In order to have a redirection, use the adb program. First, make sure adb is in your earch path. Typically, it is under Android/Sdk/platform-tools, wherever the Android SDK is located, whatever OS you are using.
Then, use the following command line:
adb forward tcp:<host port> tcp:<guest port>
(For example: adb forward tcp:8080 tcp:8080). Now, you can access port with: telnet localhost <host port>, which will be redirected to the guest.
This is very unfortunate, because (as of build 28) it isn't documented this way. I assume at some point documentation will be fixed.
Actually it depends. I've connected to and tested my SFTP Server app on an "Android 11 API 30 Emulator" and on an "Android TV 9 API 28 Emulator".
On the "Android 11 API 30 Emulator" my SFTP Server app showed up listening on IP 10.0.2.16 and port 6789 and I could connect to it using redir add tcp:<localhost-port>:6789 (further details see Setting up redirection through the Emulator Console). BUT I could as well connect to it using adb -s <emulator-id> forward tcp:<localhost-port> tcp:6789.
On the "Android TV 9 API 28 Emulator" my SFTP Server app showed up listening on IP 192.168.232.2 and port 6789 and I could ONLY connect to it using adb -s <emulator-id> forward tcp:<localhost-port> tcp:6789. I could NOT connect to it using redir add tcp:<localhost-port>:6789.
Conclusion "adb forward" is always working and therefore should be used. (Do not use "redir add tcp" that only sometimes works in the address range 10.0.2.0/24).
Related
firebase command firebase emulators:start all ports and hosts work fine on my pc but but if I try from different device in my network (ohter pc) to access network-ip:8080 I get connection refused.
This does not worked:
firebase.firestore().useEmulator("0.0.0.0", 8080);
But this worked:
firebase.firestore().useEmulator("192.168.x.x", 8080);
Why first one was not working but second one worked did not understand the reason behind this
0.0.0.0 is not a valid destination address for outgoing connections, such as those being made by the Firebase SDK to connect to the emulator. It is only a valid incoming address for services that want to listen on all possible IP addresses assign to the machine where it's running.
I recommend doing a web search for "ip address 0.0.0.0" to read more.
Are you sure that the port that you are trying to connect to is opened? I ran through the same issue with Ubuntu firewall blocking the request. If you are using Ubuntu use this command to open the port.
sudo ufw allow 9299
I'm learning how to use Meteor by following the tutorial. I'm aware that Meteor automatically hosts the app to both localhost and my IPv4 address (in this instance, 192.168.1.100). When I visit 192.168.1.100:3000 on the computer it's hosted from, the app works fine, however it won't load on any other devices that access 192.168.1.100:3000 from the local network.
I've read the following answers:
Accessing meteor server on LAN
Accessing Meteor local web server from another local device on Mac 10.8
Meteor - accessing the app using public ip
How to run meteor server on a different ip address?
Start Meteor server and let other computers access it
And none of them worked for me. It may be because I'm running Windows. If that's the case, can anyone help on how to host the app on the local network?
There's a number of reasons why you may not be able to
try opening the port
netsh advfirewall firewall add rule name="Meteor 3000" dir=in action=allow protocol=TCP localport=3000
if connecting via wifi, then routers often disallow connections to other devices on the network, check router settings
I'm trying to use NETSH PORTPROXY command to forward packets sent to my XP PC (IP 192.168.0.10) on port 8001 to port 80 (I've a XAMPP Apache server listening to port 80).
I issued the following:
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=192.168.0.10 connectport=80 connectaddress=192.168.0.10
Show all confirms that everything is configured correctly:
netsh interface portproxy show all
Listen on IPv4: Connect to IPv4:
Address Port Address Port
--------------- ---------- --------------- ----------
192.168.0.10 8001 192.168.0.10 80
However, I'm not able to access apache website from http://localhost:8001. I'm able to access through the direct port at http://localhost as shown below.
Additionally, I've also tried the following:
1. Access the Apache website from a remote PC using the link: http://192.168.0.10:8001. Firewall turned off.
2. Changing listenaddress and connectaddress to 127.0.0.1.
Without further information, I can't find a way to resolve the problem. Is there a way to debug NETSH PORTPROXY?
Note: By the way, if you're wondering why I am doing this, I actually want to map remote MySQL client connections from a custom port to the default MySQL Server port 3306.
I managed to get it to work by issuing:
netsh interface ipv6 install
Also, for my purpose, it is not required to set listenaddress and better to set connectaddress=127.0.0.1, e.g.
netsh interface portproxy add v4tov4 listenport=8001 connectport=80 connectaddress=127.0.0.1
If netsh's port proxying is not working as expected, then you should verify the followings, preferably in that order:
Make sure the port proxy is properly configured
Start or restart the related Windows service
Ensure support for IPv6 is installed
Make sure the port is not blocked by a firewall
Make sure the port proxy is properly configured
This might seems to be trivial, but just in case, take the time to review your configuration before you go any further.
From either a command prompt or PowerShell prompt, run the following command:
netsh interface portproxy show all
The result should look something like this:
Listen on ipv4: Connect to ipv4:
Address Port Address Port
--------------- ---------- --------------- ----------
24.12.12.24 3306 192.168.0.100 3306
24.12.12.24 8080 192.168.0.100 80
Carefully review those settings. Make sure that you can indeed connect to the addresses on the right side of that list, from the local computer. For example, can you locally open a web browser and reach 192.168.0.100:80? If the protocol is not HTTP, then use telnet: telnet 192.168.0.100 3306 (see here for how to install the Telnet client on Windows).
Then, are the values on the left side correct? Is the IP address valid for your machine? Is that the port number you are trying to connect to, from the external machine?
Start or restart the related Windows service
On latest versions of Windows, netsh's port proxying is handled by a Windows service named "IP Helper" or "iphlpsvc". Proxying will obviously not work if that service is stopped. I have also faced situations that turned out to be resolved by restarting that service.
To do that in latest versions of Windows:
Open the Task manager, then go to the Services tab.
In the "Name" column, find the service named either "iphlpsvc" or "IP Helper".
Right click on that service, then select Restart. If restart is not available, then the service is probably stopped, and actually has to be started, so select Start.
On previous versions of Windows, look for Services in Administrative Tools, inside the Control Panel.
Ensure support for IPv6 is installed (older releases of Windows only)
On earlier versions of Windows (that is Windows XP, for sure, upto some early releases of Windows 10, apparently, though this is not clear), netsh's port proxying feature (including for IPv4-to-IPv4 proxys) was actually handled by a DLL (IPV6MON.DLL) that was only loaded if IPV6 protocol support was enabled. Therefore, on these versions, support for the IPv6 protocol is required in order to enable netsh's port proxying (see Microsoft's support article here).
From either a command prompt or PowerShell prompt, run the following command:
netsh interface ipv6 install
If you get an error indicating that command interface ipv6 install was not found, then it means that you are using a recent release of Windows, in which netsh's IPv6 support is implicit and cannot be disabled.
Make sure the port is not blocked by a firewall
A local firewall may potentially block the port even before they reach the IP Helper service. To make validate this hypothesis, temporarily disable any local firewall (including Windows' native firewall), then retest. If that works, then simply add a port exclusion to your firewall configuration.
I have the problem with you. I have solve it just now. There is a Windows Service named "IP Helper" that supplies the funcions tunnel connections. You should ensure it has been started.
You must Run Command.exe as Administrator first, by right-clicking the Command Prompt icon and choosing Run as Administrator. You will asked to confirm.
Paste your netsh Command in the command.exe window and press Enter.
If no error message is shown, the command worked.
In your web browser go to http://your-up:8001 to see it works.
The Windows Event Log might have information to help find the cause of a failure.
I can access the app using localhost:3000 but I am trying to test from mobile devices locally, without having to deploy it. But I couldn't access the site.
I am allowing incoming request:
sudo ufw status verbose
Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing)
New profiles: skip
To Action From
-- ------ ----
3000/tcp ALLOW IN Anywhere
3000/tcp ALLOW IN Anywhere (v6)
I found that my ip address is 128.84.125.239 and so I visit 128.84.125.239:3000 and nothing happens.
This turned out to be an issue of using the right IP, or configuring the NAT of the router appropriately. Using a service such as cmyip.com will only provide you with your external IP address. This address can only reach your meteor app if your router is configured accordingly, i.e., the router will forward requests on port 3000 (or whichever port you are running your app on) to your server.
For testing on a mobile device during development you are most likely best off using your internal IP address, assuming your mobile device is on the same network as your app-serving machine.
On Linux you can use ifconfig to get your internal IPs. If you are connected via ethernet then you'll be looking for the device eth0 (in most cases). If you are connected over wifi, then the device you are looking for is typically called wlan0.
On Mac OSX you can use ifconfig as well, and look for devices called enX, where X is a number (often 0, or 2).
Your service is probably only running locally (on local ports, 127.0.0.0/8), To confirm this, run netstat -tulpn to see what services are running and on what ports/interfaces. If you don't see 0.0.0.0:3000 or 128.84.125.239:3000 then you won't be able to get ti it from the IP you are trying and you need to change the bind address of your app to be that IP (or all interaces).
Host: Windows 7 running lastest VBox + Extension pack
Vm1: lubuntu 3.10
Vm2: Ubuntu server 12.04.3
Problem: Can't get VMs talk/ping each other AND ping the internet at the same time
NAT: VMs have same IP, using ping/ssh is like checking connectivity/connecting to self, lol; can ping internet, can't ping each other
Bridged: VMs get unique IP; can ping each other, not the internet
Host-only: VMs get unique IP; can ping each other; not the internet
Internal network:
intnet, needs to be defined/added to windows 7, however, window 7 not accepting VBOXMANAGE add command, giving errors. VMs wait for network configuration, another 60 seconds and start without a network.
What else can I do?
Change VM to use NAT Network, generic driver... ???
edit /etc/network/interfaces?
change route?
use squid?
Following Lubuntu Networking Message pops up in Lunbutu GUI:
network service discovery disabled
your cuurent network has a .local domain which is not recommended and incompatible with the avahi network service discovery the service has been disabled.
Can anyone help?
Refresh your MAC address using Virtual Box machine settings and remove the kernel’s networking interface rules file so that it can be regenerated:
sudo rm -f /etc/udev/rules.d/70-persistent-net.rules
sudo reboot
It will work for your clone VM.