Android Question Fixed IP address question

bartj

Member
Hello,

I am relatively new to B4A. I came upon this issue while attempting to write some B4A code to allow me to create a wired TCP connection between an Android Galaxy tab and some hardware I have been working with. Its not really related to B4A, but I have posted this question first to several other "Android" related sites and I have received no helpful responses. The manufacturer of the USB to Ethernet adapter was also unable to provide a helpful response.

I am attempting to use a Galaxy Tab A in a local private network with no router. I have setup the following:

1) Netgear FS105 Ethernet switch (not smart)
2) Galaxy Tab A with a USB to Ethernet adapter (USB2-OTGE100)
3) Device #1 - Custom hardware at 192.168.12.9
3) Device #2 - Custom hardware at 192.168.12.10
4) Connection to my "outside world" ethernet router (just used to test network connectivity to the outside world)
5) Connection to my win 7 PC ethernet port (set to 192.168.12.100)(just used to test network connectivity to the local network)

With the Galaxy Tab set to airplane mode and the ethernet adapter set to DHCP I can ping (from the Galaxy) to the outside world (such as 8.8.8.8).
However I am unable to ping the local hardware at 192.168.12.9 or 192.168.12.10.

I am able to ping 192.168.12.9 and 192.168.12.10 from my win 7 pc. This tells me that the Devices are connected properly to the network. Note that the settings for the win7 PC are:
IP address: 192.168.12.100
IP Mask: 255.255.255.0
DNS server values are blank

I then change the Galaxy Tab's ethernet configuration to fixed IP:
IP address: 192.168.12.45
Net mask: 255.255.255.0
DNS address: 0.0.0.0
Default router 0.0.0.0

Note: I need to fully populate all 4 of the above fields before the setup can be "saved".

In this configuration I am still unable to ping 192.168.12.9 and 192.168.12.10 from the Galaxy tab.

Does anyone have any suggestions on setting the "DNS address" and "Default router" values for use in this circumstance? And/or does anyone have any suggestions for an alternate ethernet to USB adapter for the galaxy tab that is known to work in a fixed IP, no router environment?

Thanks!
 

eps

Expert
Licensed User
I think in this case the DNS address and Default router could well be the same address. It should be the address of the router that you are using. The addresses tell the device where to look for device names (and it's own one) - which is the router and the router itself, which manages the traffic. I would start there, something like 192.168.1.1 or whatever the IP address is of the router.

Are either Device A or Device B the Galaxy Tab? I guess not..

Make sure the Galaxy Tab is on a recent version of Android - but I think it is already.. ( I think it needs to be 6 or above)
 
Upvote 0

bartj

Member
Thank you for your response.

There is NO router in this configuration. There is only the Galaxy Tab and 2 boards that communicate over Ethernet. They are connected to each other via a Net-gear switch. Galaxy is in airplane mode.

The Android version of the Galaxy tab is 6.01.

Any suggestions for DNS address and Default router fields in this case?
 
Upvote 0

MicroDrie

Active Member
Licensed User
Let me try to help you in this special network design. You don't say why you can use a router and what you want to achieve, so I start unraveling your design.

The first thing to mention is the difference between a public and a private address. If you want to communicate between those private and public addresses, you need a router.
I am attempting to use a Galaxy Tab A in a local private network with no router

If you don't have a router device, you need a other routing functionality.
Default router 0.0.0.0
There is something like a routing table. Pointing to the address 0.0.0.0 in a device means that you want to reroute all the traffic which is not on your local network. The routing table address 0.0.0.0 normally points to an address which is capable to reroute the local traffic on the private network to the public network as a "routing" device or shortly "router", which you say that you don't have.

I am able to ping 192.168.12.9 and 192.168.12.10 from my win 7 pc.
A successful ping is only possible if a device is on the same private network or if there is a router connected to that network (which your claim is "there isn't). Now if, if it is possible to use a Win 7 PC to ping your devices connected on the private network and the same Win 7 PC can connect to the public Internet at the same time and network, there must be some "router" somewhere in your tested network.

The simple solution is to open a CMD box (Open start and type cmd) in the Win 7 PC. In the CMD MSDOS box type ipconfig a look to the active network interface. There you found the default gateway address which point to the router device function.

A point to the DNS address, this should be point to a DNS server in your private or public network like Gooogles DNS server on 8.8.8.8. In a private network with a router you will see that some configurations points to the default gateway address in those cases that the router reroute the DNS address to a DNS server in the private or public network.

If this explanation is not the solution, we can only help you if you explain more precisely what you want to achieve.
 
Upvote 0

bartj

Member
Hello,

Thank you for your response!

First let me describe the network system that I have working (dozens of deployments) using win 7 boxes and Vb.Net. They each consist of 1 win 7 laptop and 2 or more(up to 10) Ethernet enabled RFID readers each with a unique IP address (192.168.12.10, 192.168.12.11, etc) Each local RFID reader and the PC are connected to each other via an UN-managed switch. The laptop operates in airplane mode. These private networks operate independently from each other. There is NO communication between them or to the outside world. The laptop in each case is setup as follows:
Capture1.PNG

Note that the above "local private" networks all run with NO router.

Now, instead of using win 7 boxes I would like to use a Galaxy Tab tablet instead(with B4A code).

And yes, in my original post, I did have my development laptop connected "to the internet" via a router. This was strictly done to test that the USB to Ethernet dongle connected to the Galaxy Tab was indeed functional.

But in any case, here is my win7 ipconfig result:
Capture2.PNG

Capture3.PNG


So, hopefully I have adequately described what I am attempting to attain. And as you can see, the win 7 system is running with no gateway or router.

So the question stands as to how to setup the Galaxy Tab (Android) DNS address and Default router fields?

Thanks again.
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    16.6 KB · Views: 38
Upvote 0

MicroDrie

Active Member
Licensed User
So the question stands as to how to setup the Galaxy Tab (Android) DNS address and Default router fields?

Well this is a special and not widely implemented isolated network to find reference and how to deal with it.

Let takes a difference approach: There is nothing as far as I knows, to mark your totally isolated Win 7 PC as a router and / or DNS server beside of the fact if it is capable to route and / or act as a DNS server. The pro is that you could find some logging on your Win 7 PC. The back site is that The Win 7 PC could have a "Dead Gateway Detection" because their usn't a gateway (defined). I don't no how the Win 7 PC react on DNS request without a running DNS server.

Now if you are not interested such "hacking" request, I would be configure both default gateway and DNS server addresses as a simple local not-routed non-used address like 192.168.12.1. Both the network and DNS request will be never be answered in your network for both situations. Is is something which are most likely foreseen in the Operating system on the Galaxy Tab (Android). Lucky if the user see a error message without a crash of the application or network cards.

DNS wise not very much will change when you configure a DNS server on the Win 7 PC. The kind of "no-reply network" error message will be replace with some kind of "not know DNS address". Again a situation that could be foreseen.

Configure a Default Gateway address on the Win 7 PC introducing the possibility that such request is target by the "Dead Gateway Detection". I have no experience how Windows will handle and reply on such situation. and most likely, the software designer of the Galaxy Tab (Android) and your application most likely also not. I foresee therefore a must higher risk of a application or OS crash or "strange" error message.

My ques is that configuring a fake not used IP address of 192.168.12.1 is your best bet for both the default gateway, as for the DNS server address because I foresee the biggest change that your program(s) on the Galaxy Tab (Android) devices will not crash.
 
Upvote 0

bartj

Member
Thank you again for your eloquent response!

I tried your suggestion of setting the win 7 test PC to use 192.168.12.1 for the DNS server and default gateway. In this case I am able to ping the devices as expected:

Capture4.PNG


Capture5.PNG


However, on the Galaxy Tab, if I set the DNS server and default gateway to 192.168.12.1, I am still unable to ping the devices. I get the error message: "destination host unreachable".

Comments or suggestions?

Thanks again.
 
Upvote 0

MicroDrie

Active Member
Licensed User
We must dive deeper in this challenge. It is for me more then 40 years ago that I invest such challenge with a protocol analyzer.
The specification for the USB 2.0 OTG Micro-B to 10/100 Network Adapter has a AX88772 Compatibility List. Based on user experience, the Galaxy Tab A has is not supported out of the box. However you found out that network wise connection is possible.

Based on your first post I draw the following network:
1606651124088.png


I think that the router configuration could work with a default gateway as 192.168.12.1 and subnet mask as 255.255.255.0. With all devices with a fix address, no DHCP is needed. And by the way DHCP has more then one principle. This introduce the possibility to test on a different ways. So what happens or better wrote can the Galaxy Tab A communicate with both the PC and the out-side world in test phase when he has a fix address of 192.168.12.45, a subnet mask of 255.255.255.0, default gateway address of 192.168.12.1 and DNS address of 192.168.12.1? To prevent the introduction of DNS problems you must use the underlying IP address of public destination found in the following given ping command in a DOS command box: ping -a www.google.com gives 172.217.17.36

You have to "rebuild" your network.
  1. Start with configure all devices in the 192.168.12.x network with the correct fix settings and DHCP off.
  2. Rebuild your network by everything switch off.
  3. Boot the router with No DHCP server
  4. Turn on the Galaxy Tab A
  5. Test connectivity with the public world
  6. Turn on one RFID reader
  7. Test on both the Galaxy Tab A and the RFID reader what you can ping
  8. Boot and test the next RFID reader repeat the previous ping test and test also connectivity between the RFID devices.
  9. If everything goes well then boot the Windows 7 PC
  10. What happens when you connect the PC, is it still possible to successfully repeat all the previous test?

I see also that NetBIOS over Tcpip is enabled. Netbios is an ugly protocol which Microsoft introduce to connect PC over a network. Ugle because all kind of things happens "under water" like the election of the Master browser each time when a new device is added on the network. I don t think you need network shares or other types of network connections to or from the Win 7 PC. But we park this point to fix after you have test the network with all network fixes.

Edit: numbering of the test steps to make it easyer to refer to a fail step.
 
Last edited:
Upvote 0

bartj

Member
Again thank you for your response...and the beautiful diagram.

I went to the site of the USB adapter manufacturer and I found that the Galaxy tab running 6.01 is known to be compatible as reported by other users.

I repeated an earlier "experiment" using the connection diagram as you show: I set the Galaxy tab to DHCP and attempted:
ping google.com (from the Galaxy Tab) (using a terminal program). It successfully pings and shows the google IP address as 172.217.3.206.
This shows that the USB adapter is working from a hardware standpoint.

As I do not wish to disturb other users of the router, I have ordered another router which I expect to be delivered on Wednesday or Thursday of this week (West Coast USA).

I will conduct the list of 10 steps you have put together when the router arrives and post my findings.

Thanks again for your help!
 
Upvote 0

MicroDrie

Active Member
Licensed User
This shows that the USB adapter is working from a hardware standpoint.
Android itself doesn't support the ICMP protocol. The fact that the ping is working means that some additional software is installed that has added the ICMP protocol. I'm not a Java expert, however I have made a B4X ping program to test ping traffic between a Android and an PC. Sadly the results are sometimes good and sometimes bad.

The good news is that the program Ping & Net in the Google play store available is. It is a Swiss army knife with a lot of network tools. I have it installed on an old WiFi connected Samsung Galaxy J7 with Android 9 and a WiFi connected Samsung Galaxy Tab S2 with Android 7. I can ping between those devices without any problem.

This brings me to the purpose and means for your problem. If a ping command is only needed to test connectivity between devices (the purpose) then Ping & Net can fulfill your Means requirement.

If your purpose is to integrate a Ping function in a self made program, then your have to solve a lot of problems now and with all kinds of security measures in the Android environment becoming increasingly strict, it is very uncertain and very labor-intensive to get and keep your program solution working.
 
Upvote 0

bartj

Member
Hello again,

By adding a router (Trendnet TW100-S4W1CA) I am able to "ping" from the Galaxy Tab!

I first configured the router to have as its LAN address 192.168.12.1 with a mask of 255.255.255.0. I Turned off its DHCP.

I then connect as follows:
Win 7 PC is connected to Router port #2 (PC is set to a fixed IP 192.168.12.100, mask = 255.255.255.0 and no DNS servers are specified)(for testing)
Netgear switch port #2 is connected to connected to Router port #3
Galaxy tab connects to port #5 of the Netgear switch via the Ethernet to USB adapter (USB2-OTGE100) (IP = 192.168.12.45, mask = 255.255.255.0)
RFID reader #1(IP = 192.168.12.9) connects to port #4 of the Netgear switch
RFID reader #2(IP = 192.168.12.10) connects to port #3 of the Netgear switch

Using "Ping & net" I can, from the Galaxy Tab ping everyone connected (RFID readers, the PC and the router). This is good.

Although I have no explanation, if I then remove either of the two connections to the router or its power, I am still able to ping the 2 RFID readers from the Galaxy. If I re-start everyone(Galaxy Tab and the RFID readers) but first disconnect the router I am unable to ping from the Galaxy Tab to either of the 2 RFID readers. I do not have a great deal of experience concerning networks so this is somewhat puzzling. Obviously the router provides some sort of address/MAC initializing for the switch and then its no longer required once the addresses are established. This is a function that windows appears to manage without the need of a router on local private networks.

In any case, thank you for your patience and helpful suggestions!
 
Upvote 0

MicroDrie

Active Member
Licensed User
Good news that connectivity can work. I wrote "can" because, based on 4 decades of programming and several decades network trouble shooting, I think this is what happen:
  1. A device is booting up. In the Power-On Self-Test (POST) it detects the Ethernet device.
  2. The Ethernet driver POST driver initialization send a broadcast to "Say hello here I'am" to all devices in the sub-net.
  3. A routing device keeps a list of all devices on the sub net even when DHCP is turn-off only for a certain length of time. So if the routing device on any way give response to the booting device, the software on the booting devices knows that he is not the only one on the network. So on the other hand why should a booting device become active if he is the only network device?
The answer is energy savings by thinking that you are the only network device to go offline. This is such a typically "smart" solution that in certain cases leads to "stupid" problems.

Back to the purpose and means question. You do now know that connecting a router to the network opens connectivity to a device that reboot till the first reboot and only for a certain length of time.
So you need to make a choice how to deal with it:
  1. If you need always 7 * 24 hours ping connectivity: Then you need a router with an active interface on your isolated network (with or without connectivity to the public network)
  2. If you need only during debugging ping connectivity: After completing the debugging, you need to remove the router (or switch it off) first and then reboot all devices on the network.
If you don't make a choice between one of the two pieces of advice and you (occasionally) need a ping, this guarantees you will run into this problem again.

Glad we could solve your problem together. Good luck with your network and the use of it.
 
Upvote 0
Top