When connecting to a wireless hotspot provided by someone on a 3/4G network, does your device get an IP address? - mobile

Two parts to this question:
1) Say a person is providing a wireless hotspot to me as I have no internet, when I access the internet what is my IP address set as?
--> Some companies basic level of fraud detection I assume is that the geographical location of the IP address is nowhere near the location of the IP of the device accessing whatever service it may be. So if you were on a mobile device accessing a site from a geographical location similar to the usual device, would this bypass this?
2) How can you find out the IP address of your device when on a hotspot

Say a person is providing a wireless hotspot to me as I have no
internet, when I access the internet what is my IP address set as?
When a person connects to a wireless hotspot, two IP addresses are set i.e. a Private IP address and a Public IP address. The wireless hotspot automatically allots the requesting device a Private IP address from a range of available IP addresses which is unique to that device. The device then connects to the internet via a Public IP address.
To break this down, when you turn on Mobile Hotspot, your phone's WiFi adapter turns on the router mode. Now the IP address is assigned by the wifi adapter running in router mode. In stock Android devices the default IP of your phone will become 192.168.42.1 and subnet mask of 255.255.255.0. However, this might change.
How can you find out the IP address of your device when on a hotspot?
In Windows, use ipconfig in cmd. Look for Default Gateway under your network adapter for your router's IP address. Look for IPv4 Address under the same adapter section to find your computer's IP address. Replace ipconfig with ifconfig in linux.

Use -ip neigh - in a linux terminal installed on android phone. It returns IP and MAC of devices connected to android hot spot.

Related

Search device using MAC address

I want to check presence of a device in network. The IP address of device keeps on changing. Is there any way I can search device through MAC address.
Through ARP I can ping the device but as IP keep on changing, I am thinking get device through MAC address.
Is there any mechanism to search device through MAC.
On Linux, you can use a tool called arp-scan.
Not sure what you tried so far.
arp -s < IP address > < MAC address >
There is an interesting article published by Microsoft
https://technet.microsoft.com/en-us/library/cc961394.aspx

Get multiple network interface gateway address in linux

There are many ways to get the network interfaces IP adresses in GNU/Linux (for example with ioctl calls). And also, default gateway from the routing table is available in C.
But I have 2 network interfaces in 2 different networks. Each of these have unique router IP addresses (gateway addresses). How can I get these addresses? The DHCP offers tells them as well and I'm able to get them with nmcli device list for example. But where is this information stored? The NetworkManager database? I want to reach them from C.
Under Linux an IPv4 interface's gateway can be read from /proc/net/route.

How to match Ethernet Shield and PC's subnet

I am new to Ethernet Shield. I have been trying the Ethernet examples in my Arduino IDE but none of them worked. According to one of the tutorials I have read, PC and Ethernet shield must have the same subnet. Now, how do I do that? I badly need help, thank you.
In layman's terms:
Being on the same subnet, means that the IP-address is equal, apart from the last number. I.e. The PC has IP address 192.168.0.5, the arduino has IP address 192.168.0.6.
They should be connected to the same router/switch, they should have the same netmask and gateway, but the last number of the IP address has to be different. You should also make sure that no other device on the network is using that IP address.

MAC Address of other wifi device in a wifi network

Is it possible to find the MAC address of all other wifi enabled device in a wifi network programmatically by using C or C++, if so then please tell me the way or direction, how can i do that Visual Studio 2012.
If they are in same LAN next to your device (no router/switch in the middle, The scope of ARP is link-layer.) you should use sending ARP packets to devices.
Address Resolution Protocol (ARP) is a telecommunications protocol
used for resolution of network layer addresses into link layer
addresses.
To send ARPs you can use Pcap or SendARP.

How can I extract mac address from a icmp reply in c on linux

I am trying to find out mac address of a machine in a switched environment after sending it a raw packet. I am trying to implement traceroute command . I want to know when i receive a ICMP time exceeded message how can I extract the mac address of that machine . I am a new to network programming so am confused what socket call will help me to extract the mac address.
Thanks .
No, you can not extract MAC address from ICMP reply.
You can only determine MAC addresses of linked machines next to you. In ICMP(tracert) you can just find out the IP address of target or middle machine.
If you want to detect MAC addresses, you should use ARP protcols where it's applicable in local networks not Internet.
ICMP protocol starts after IPv4 header[1] and MAC addresses is related to physical/link layer. In low level layers the MAC addresses will transparent from top level layers such as network(IP) or Transmission,...
To determining MAC addresses, you should use Raw sockets or PCAP SDKs to access lower layers of network programming. (I say again, these are not useful over Internet)
Like Masoud M said, you can only get the MAC address of machines that are on your local network. That said, you can parse the output the arp command to find the MAC address given the IP address of a machine one your local network.
In general, on internet, you don't even know the media a host is using for transmitting packets. Let's suppose a remote host is conected over a serial rs-232-C link with PPP protocol. It doesn't have a mac address. This also happens for example if the host uses a token ring interface or frame relay link. This makes determining the remote mac addresses of hosts a local issue completely. Normally, when you get a packet from a remote site over ethernet, the source mac addres you get in the packet is the one of the last router that links you to the internet, not the one of the original host that sent the IP packet. In the RFC on IP over avian carriers (rfc1149, rfc2549 and rfc6214) the media used for transmission doesn't allow to use mac addresses (the link address, if somewhat feasible on a pidgeon could be, would be its name)
If you want to read about traceroute on ethernet network of switches, perhaps you had to have a look at the IEEE802.1ag, that has an specification to do tracerouting over switches (tracelink service) but I think is far over the scope of this answer.

Resources