Macos Determin App Sending To Ip Address

How would you communicate with a device when you don’t have the IP?

However, computers connected to the same TCP/IP local network can determine each other's MAC addresses. The technology called ARP - Address Resolution Protocol included with TCP/IP makes it possible. Using ARP, each computer maintains a list of both IP and MAC addresses for each device it has recently communicated with. The middleware defaults to sending a Status307TemporaryRedirect with all redirects. If you prefer to send a permanent redirect status code when the app is in a non-Development environment, wrap the middleware options configuration in a conditional check for a non-Development environment.

Mar 29, 2020  AD lockout event includes computer name or IP address. Ninety nine times out of a hundred the app on the IOS or Android gadget that was sending out the bad credentials is an Exchange email client—e.g., ActiveSync. The locked out user will then need to update the password to refresh the credentials and bring everything back in sync.

You might be in a situation where you don’t have the IP address of a device in a local network, but all you have is records of the MAC or hardware address.

Or your computer is unable to display its IP due to various reasons, and you are getting a “No Valid IP Address” error.

Finding the IP from a known MAC address should be the task of a ReverseARP application, the counterpart of ARP.

But RARP is an obsolete protocol with many disadvantages, so it was quickly replaced by other protocols like BOOTP and DHCP, which deal directly with IP addresses.

In this article, we’ll show you how to find IPs and device vendors using MAC addresses with different methods for free.

Understanding ARP

ARP (Address Resolution Protocol) is the protocol in charge of finding MAC addresses with IPs in local network segments.

It operates with frames on the data link layer.

As you might already know, devices in the data link layer depend on MAC addresses for their communication.

Their frames encapsulate packets that contain IP address information.

A device must know the destination MAC address to communicate locally through media types like Ethernet or Wifi, in layer 2 of the OSI model.

Understanding how ARP works can help you find IPs and MAC addresses quickly.

The following message flow diagram can help you understand the concept:

  1. The local computer sends a ping (ICMP echo request) to a destination IP address (remote computer) within the same segment. Unfortunately, the local computer does not know the MAC address… it only knows the IP address.
  2. The destination hardware address is unknown, so the ICMP echo request is put on hold. The local computer only knows its source/destination IP and its source MAC addresses. ARP uses two types of messages, ARP Request and Reply.

The local computer sends an ARP REQUEST message to find the owner of the IP address in question.

This message is sent to all devices within the same segment or LAN through a broadcast MAC (FF:FF:FF:FF:FF:FF) as the destination.

  1. Because the remote computer is part of the same network segment, it receives the broadcast message sent by the local computer. All other computers in the LAN also receive the broadcast but they know that the destination IP is not theirs, so they discard the packet. Only the remote computer with destination IP, responds to the ARP REQUEST with an ARP REPLY, which contains the target MAC address.
  2. The local computer receives the ARP REPLY with the MAC address. It then resumes the ICMP echo request, and finally, the remote computer responds with an ICMP echo reply.

Finding IPs with ARP

You can use ARP to obtain an IP from a known MAC address.

But first, it is important to update your local ARP table in order to get information from all devices in the network.

Send a ping (ICMP echo reply) to the entire LAN, to get all the MAC entries on the table.

To ping the entire LAN, you can send a broadcast to your network.

Open the Command Prompt in Windows or terminal in macOS and type.

ping 192.168.0.255

My subnet is 192.168.0.0/24 (mask of 255.255.255.0), so the broadcast address is 192.168.0.255 which can be calculated or found with a “Print Route” command in Windows or a “netstat -nr” in macOS. Or can also be obtained with a subnet calculator.

For Windows:

Step 1.

  • Open the CMD (Command Prompt)
  • Go to the “Start” menu and select “Run” or press (Windows key + R) to open the Run application
  • In the “Open” textbox type “cmd” and press “Ok”.

This will open the command-line interface in Windows.

Step 2.

  • Enter the “arp” command.
  • The arp command without any additional arguments will give you a list of options that you can use.

Step 3.

  • Use the arp with additional arguments to find the IP within the same network segment.
  • With the command “arp -a” you can see the ARP table and its entries recently populated by your computer with the broadcast ping.

Step 4.

  • Reading the output.
  • The information displayed in the arp-a is basically the ARP table on your computer.
  • It shows a list with IP addresses, their corresponding physical address (or MAC), and the type of allocation (dynamic or static).

Let’s say you have the MAC address 60-30-d4-76-b8-c8 (which is a macOS device) and you want to know the IP.

From the results shown above, you can map the MAC address to the IP address in the same line.

The IP Address is 192.168.0.102 (which is in the same network segment) belongs to 60-30-d4-76-b8-c8.

You can forget about those 224.0.0.x and 239.0.0.x addresses, as they are multicast IPs.

For macOS:

Step 1:

  • Open the Terminal App. go to Applications > Utilities > Terminal or Launchpad > Other > Terminal.

Step 2:

  • Enter the “arp” command with an “-a” flag.
  • Once you enter the command “arp -a” you’ll receive a list with all ARP entries to the ARP Table in your computer.
  • The output will show a line with the IP address followed by the MAC address, the interface, and the allocation type (dynamic/static).

Finding IPs with the DHCP Server

The Dynamic Host Configuration Protocol (DHCP) is the network protocol used by TCP/IP to dynamically allocate IP addresses and other characteristics to devices in a network.

The DHCP works with a client/server mode.

The DHCP server is the device in charge of assigning IP addresses in a network, and the client is usually your computer.

For home networks or LANs, the DHCP Server is typically a router or gateway.

If you have access to the DHCP Server, you can view all relationships with IPs, MACs, interfaces, name of the device, and lease time in your LAN.

Step 1.

  • Log into the DHCP Server. In this example, the DHCP server is the home gateway.
  • If you don’t know the IP address of your DHCP Server/ Gateway, you can run an ipconfig (in Windows) or ifconfig (in macOS/Linux).
  • This particular DHCP Server/Gateway has a web interface.

Step 2.

  • Enter the IP address on the search bar of the web browser, and input the right credentials.

Step 3.

  • Find the DHCP Clients List.
  • In this TP-Link router, the DHCP Server functionality comes as an additional feature.
  • Go to DHCP > DHCP Clients List. From this list, you can see the mapping between MAC addresses and their assigned IPs.

Using Sniffers

If you couldn’t find the IP in the ARP list or unfortunately don’t have access to the DHCP Server, as a last resort, you can use a sniffer.

Packet sniffers or network analyzers like Nmap (or Zenmap which is the GUI version) are designed for network security.

They can help identify attacks and vulnerabilities in the network.

With Nmap, you can actively scan your entire network and find IPs, ports, protocols, MACs, etc.

If you are trying to find the IP from a known MAC with a sniffer like Nmap, look for the MAC address within the scan results.

How to find the Device and IP with a Sniffer?

Step 1.

  • Keep records of your network IP address information.
  • In this case, my network IP is 192.168.0.0/24. If you don’t know it, a quick “ipconfig” in Windows cmd or an “ifconfig” in macOS or Linux terminal can show you the local IP and mask.
  • If you can’t subnet, go online to a subnet calculator and find your network IP.

Step 2.

  • Download and open Nmap.
  • Download Nmap from this official link https://nmap.org/download.html and follow its straightforward installation process.

Step 3.

  • Open Nmap (or Zenmap) and use the command “sudo nmap -sn (network IP)” to scan the entire network (without port scan).
  • The command will list machines that respond to the Ping and will include their MAC address along with the vendor.
  • Don’t forget the “sudo” command.
  • Without it, you will not see MAC addresses.

Finding out the device vendor from a MAC address

Ok, so now you were able to find out the IP address using “arp -a” command or through the DHCP Server.

But what if you want to know more details about that particular device?

What vendor is it?

Your network segment or LAN might be full of different devices, from computers, firewalls, routers, mobiles, printers, TVs, etc.

And MAC addresses contain key information for knowing more details about each network device.

First, it is essential to understand the format of the MAC address.

Traditional MAC addresses are 48 bits represented in 12-digit hexadecimal numbers (or six octets).

The first half of the six octets represent the Organizational Unique Identifier (OUI) and the other half is the Network Interface Controller (NIC) which is unique for every device in the world.

There is not much we can do about the NIC, other than communicating with it.

But the OUI can give us useful information about the vendor if you didn’t use Nmap, which can also give you the hardware vendor.

A free online OUI lookup tool like Wireshark OUI Lookup can help you with this.

Just enter the MAC address on the OUI search, and the tool will look at the first three octets and correlate with its manufacturing database.

Final Words

Although the RARP (the counterpart of ARP) was specifically designed to find IPs from MAC addresses, it was quickly discontinued because it had many drawbacks.

RARP was quickly replaced by DHCP and BOOTP.

But ARP is still one of the core functions of the IP layer in the TCP/IP protocol stack.

It finds MAC addresses from known IPs, which is most common in today’s communications.

ARP works under the hood to keep a frequently used list of MACs and IPs.

But you can also use it to see the current mappings with the command arp -a.

Aside from ARP, you can also use DHCP to view IP information. DHCP Servers are usually in charge of IP assignments.

If you have access to the DHCP server, go into the DHCP Client list and identify the IP with the MAC address.

Finally, you can use a network sniffer like Nmap, scan your entire network, and find IPs, and MACs.

If you only want to know the vendor, an online OUI lookup like Wireshark can help you find it quickly.

-->

By Rick Anderson

This document shows how to:

  • Require HTTPS for all requests.
  • Redirect all HTTP requests to HTTPS.

No API can prevent a client from sending sensitive data on the first request.

Warning

API projects

Do not use RequireHttpsAttribute on Web APIs that receive sensitive information. RequireHttpsAttribute uses HTTP status codes to redirect browsers from HTTP to HTTPS. API clients may not understand or obey redirects from HTTP to HTTPS. Such clients may send information over HTTP. Web APIs should either:

  • Not listen on HTTP.
  • Close the connection with status code 400 (Bad Request) and not serve the request.

HSTS and API projects

The default API projects don't include HSTS because HSTS is generally a browser only instruction. Other callers, such as phone or desktop apps, do not obey the instruction. Even within browsers, a single authenticated call to an API over HTTP has risks on insecure networks. The secure approach is to configure API projects to only listen to and respond over HTTPS.

Warning

API projects

Do not use RequireHttpsAttribute on Web APIs that receive sensitive information. RequireHttpsAttribute uses HTTP status codes to redirect browsers from HTTP to HTTPS. API clients may not understand or obey redirects from HTTP to HTTPS. Such clients may send information over HTTP. Web APIs should either:

  • Not listen on HTTP.
  • Close the connection with status code 400 (Bad Request) and not serve the request.

Require HTTPS

We recommend that production ASP.NET Core web apps use:

  • HTTPS Redirection Middleware (UseHttpsRedirection) to redirect HTTP requests to HTTPS.
  • HSTS Middleware (UseHsts) to send HTTP Strict Transport Security Protocol (HSTS) headers to clients.

Note

Apps deployed in a reverse proxy configuration allow the proxy to handle connection security (HTTPS). If the proxy also handles HTTPS redirection, there's no need to use HTTPS Redirection Middleware. If the proxy server also handles writing HSTS headers (for example, native HSTS support in IIS 10.0 (1709) or later), HSTS Middleware isn't required by the app. For more information, see Opt-out of HTTPS/HSTS on project creation.

UseHttpsRedirection

The following code calls UseHttpsRedirection in the Startup class:

The preceding highlighted code:

  • Uses the default HttpsRedirectionOptions.RedirectStatusCode (Status307TemporaryRedirect).
  • Uses the default HttpsRedirectionOptions.HttpsPort (null) unless overridden by the ASPNETCORE_HTTPS_PORT environment variable or IServerAddressesFeature.

We recommend using temporary redirects rather than permanent redirects. Link caching can cause unstable behavior in development environments. If you prefer to send a permanent redirect status code when the app is in a non-Development environment, see the Configure permanent redirects in production section. We recommend using HSTS to signal to clients that only secure resource requests should be sent to the app (only in production).

Port configuration

A port must be available for the middleware to redirect an insecure request to HTTPS. If no port is available:

  • Redirection to HTTPS doesn't occur.
  • The middleware logs the warning 'Failed to determine the https port for redirect.'

Specify the HTTPS port using any of the following approaches:

  • Set HttpsRedirectionOptions.HttpsPort.
  • Set the https_porthost setting:

    • In host configuration.

    • By setting the ASPNETCORE_HTTPS_PORT environment variable.

    • By adding a top-level entry in appsettings.json:

  • Indicate a port with the secure scheme using the ASPNETCORE_URLS environment variable. The environment variable configures the server. The middleware indirectly discovers the HTTPS port via IServerAddressesFeature. This approach doesn't work in reverse proxy deployments.

  • Set the https_porthost setting:

    • In host configuration.

    • By setting the ASPNETCORE_HTTPS_PORT environment variable.

    • By adding a top-level entry in appsettings.json:

  • Indicate a port with the secure scheme using the ASPNETCORE_URLS environment variable. The environment variable configures the server. The middleware indirectly discovers the HTTPS port via IServerAddressesFeature. This approach doesn't work in reverse proxy deployments.

  • In development, set an HTTPS URL in launchsettings.json. Enable HTTPS when IIS Express is used.

  • Configure an HTTPS URL endpoint for a public-facing edge deployment of Kestrel server or HTTP.sys server. Only one HTTPS port is used by the app. The middleware discovers the port via IServerAddressesFeature.

Note

When an app is run in a reverse proxy configuration, IServerAddressesFeature isn't available. Set the port using one of the other approaches described in this section.

Edge deployments

When Kestrel or HTTP.sys is used as a public-facing edge server, Kestrel or HTTP.sys must be configured to listen on both:

  • The secure port where the client is redirected (typically, 443 in production and 5001 in development).
  • The insecure port (typically, 80 in production and 5000 in development).

The insecure port must be accessible by the client in order for the app to receive an insecure request and redirect the client to the secure port.

For more information, see Kestrel endpoint configuration or HTTP.sys web server implementation in ASP.NET Core.

Macos Determine App Sending To Ip Address Change

Deployment scenarios

Any firewall between the client and server must also have communication ports open for traffic.

If requests are forwarded in a reverse proxy configuration, use Forwarded Headers Middleware before calling HTTPS Redirection Middleware. Forwarded Headers Middleware updates the Request.Scheme, using the X-Forwarded-Proto header. The middleware permits redirect URIs and other security policies to work correctly. When Forwarded Headers Middleware isn't used, the backend app might not receive the correct scheme and end up in a redirect loop. A common end user error message is that too many redirects have occurred.

When deploying to Azure App Service, follow the guidance in Tutorial: Bind an existing custom SSL certificate to Azure Web Apps.

Options

The following highlighted code calls AddHttpsRedirection to configure middleware options:

Calling AddHttpsRedirection is only necessary to change the values of HttpsPort or RedirectStatusCode.

The preceding highlighted code:

  • Sets HttpsRedirectionOptions.RedirectStatusCode to Status307TemporaryRedirect, which is the default value. Use the fields of the StatusCodes class for assignments to RedirectStatusCode.
  • Sets the HTTPS port to 5001.

Configure permanent redirects in production

The middleware defaults to sending a Status307TemporaryRedirect with all redirects. If you prefer to send a permanent redirect status code when the app is in a non-Development environment, wrap the middleware options configuration in a conditional check for a non-Development environment.

When configuring services in Startup.cs:

HTTPS Redirection Middleware alternative approach

An alternative to using HTTPS Redirection Middleware (UseHttpsRedirection) is to use URL Rewriting Middleware (AddRedirectToHttps). AddRedirectToHttps can also set the status code and port when the redirect is executed. For more information, see URL Rewriting Middleware.

When redirecting to HTTPS without the requirement for additional redirect rules, we recommend using HTTPS Redirection Middleware (UseHttpsRedirection) described in this topic.

HTTP Strict Transport Security Protocol (HSTS)

Per OWASP, HTTP Strict Transport Security (HSTS) is an opt-in security enhancement that's specified by a web app through the use of a response header. When a browser that supports HSTS receives this header:

  • The browser stores configuration for the domain that prevents sending any communication over HTTP. The browser forces all communication over HTTPS.
  • The browser prevents the user from using untrusted or invalid certificates. The browser disables prompts that allow a user to temporarily trust such a certificate.

Because HSTS is enforced by the client, it has some limitations:

  • The client must support HSTS.
  • HSTS requires at least one successful HTTPS request to establish the HSTS policy.
  • The application must check every HTTP request and redirect or reject the HTTP request.

ASP.NET Core 2.1 and later implements HSTS with the UseHsts extension method. The following code calls UseHsts when the app isn't in development mode:

Macos Determin App Sending To Ip Address

UseHsts isn't recommended in development because the HSTS settings are highly cacheable by browsers. By default, UseHsts excludes the local loopback address.

For production environments that are implementing HTTPS for the first time, set the initial HstsOptions.MaxAge to a small value using one of the TimeSpan methods. Set the value from hours to no more than a single day in case you need to revert the HTTPS infrastructure to HTTP. After you're confident in the sustainability of the HTTPS configuration, increase the HSTS max-age value; a commonly used value is one year.

The following code:

Macos determin app sending to ip address to iphone
  • Sets the preload parameter of the Strict-Transport-Security header. Preload isn't part of the RFC HSTS specification, but is supported by web browsers to preload HSTS sites on fresh install. For more information, see https://hstspreload.org/.
  • Enables includeSubDomain, which applies the HSTS policy to Host subdomains.
  • Explicitly sets the max-age parameter of the Strict-Transport-Security header to 60 days. If not set, defaults to 30 days. For more information, see the max-age directive.
  • Adds example.com to the list of hosts to exclude.

UseHsts excludes the following loopback hosts:

  • localhost : The IPv4 loopback address.
  • 127.0.0.1 : The IPv4 loopback address.
  • [::1] : The IPv6 loopback address.

Opt-out of HTTPS/HSTS on project creation

In some backend service scenarios where connection security is handled at the public-facing edge of the network, configuring connection security at each node isn't required. Web apps that are generated from the templates in Visual Studio or from the dotnet new command enable HTTPS redirection and HSTS. For deployments that don't require these scenarios, you can opt-out of HTTPS/HSTS when the app is created from the template.

To opt-out of HTTPS/HSTS:

Uncheck the Configure for HTTPS check box.

Use the --no-https option. For example

Trust the ASP.NET Core HTTPS development certificate on Windows and macOS

The .NET Core SDK includes an HTTPS development certificate. The certificate is installed as part of the first-run experience. For example, dotnet --info produces a variation of the following output:

Installing the .NET Core SDK installs the ASP.NET Core HTTPS development certificate to the local user certificate store. The certificate has been installed, but it's not trusted. To trust the certificate, perform the one-time step to run the dotnet dev-certs tool:

The following command provides help on the dev-certs tool:

How to set up a developer certificate for Docker

Macos Determin App Sending To Ip Address To Google

See this GitHub issue.

Trust HTTPS certificate from Windows Subsystem for Linux

The Windows Subsystem for Linux (WSL) generates an HTTPS self-signed cert. To configure the Windows certificate store to trust the WSL certificate:

  • Run the following command to export the WSL-generated certificate:

  • In a WSL window, run the following command:

    The preceding command sets the environment variables so Linux uses the Windows trusted certificate.

Troubleshoot certificate problems

This section provides help when the ASP.NET Core HTTPS development certificate has been installed and trusted, but you still have browser warnings that the certificate is not trusted. The ASP.NET Core HTTPS development certificate is used by Kestrel.

All platforms - certificate not trusted

Run the following commands:

Close any browser instances open. Open a new browser window to app. Certificate trust is cached by browsers.

The preceding commands solve most browser trust issues. If the browser is still not trusting the certificate, follow the platform-specific suggestions that follow.

Docker - certificate not trusted

  • Delete the C:Users{USER}AppDataRoamingASP.NETHttps folder.
  • Clean the solution. Delete the bin and obj folders.
  • Restart the development tool. For example, Visual Studio, Visual Studio Code, or Visual Studio for Mac.

Windows - certificate not trusted

  • Check the certificates in the certificate store. There should be a localhost certificate with the ASP.NET Core HTTPS development certificate friendly name both under Current User > Personal > Certificates and Current User > Trusted root certification authorities > Certificates
  • Remove all the found certificates from both Personal and Trusted root certification authorities. Do not remove the IIS Express localhost certificate.
  • Run the following commands:

Close any browser instances open. Open a new browser window to app.

OS X - certificate not trusted

  • Open KeyChain Access.
  • Select the System keychain.
  • Check for the presence of a localhost certificate.
  • Check that it contains a + symbol on the icon to indicate it's trusted for all users.
  • Remove the certificate from the system keychain.
  • Run the following commands:

Close any browser instances open. Open a new browser window to app.

See HTTPS Error using IIS Express (dotnet/AspNetCore #16892) for troubleshooting certificate issues with Visual Studio.

IIS Express SSL certificate used with Visual Studio

To fix problems with the IIS Express certificate, select Repair from the Visual Studio installer. For more information, see this GitHub issue.

Additional information