in linux,what command using nmap to determine server purpose
What is Nmap?
Nmap, or Network Mapper, is an open source Linux command line tool for network exploration and security auditing. With Nmap, server administrators can chop-chop reveal hosts and services, search for security issues, and browse for open up ports.
The Nmap tool can audit and discover local and remote open up ports, as well as network information and hosts.
Here are some of the nigh useful Nmap commands in Linux with examples.
1. Nmap Command to Browse for Open Ports
When scanning hosts, Nmap commands tin can use server names, IPV4 addresses or IPV6 addresses. A basic Nmap command will produce information near the given host.
nmap subdomain.server.com
Without flags, as written in a higher place, Nmap reveals open up services and ports on the given host or hosts.
nmap 192.168.0.ane
Nmap can reveal open up services and ports past IP address too as by domain name.
nmap -F 192.168.0.one
If you demand to perform a browse quickly, you can use the "-F" flag. The "-F" flag will list ports on the nmap-services files. Because the -F "Fast Scan" flag does not browse every bit many ports, it isn't every bit thorough.
two. Scan Multiple Hosts
Nmap can scan multiple locations at once rather than scanning a single host at a time. This is useful for more extensive network infrastructures. There are several means to scan numerous locations at once, depending on how many locations you lot need to examine.
nmap 192.168.0.one 192.168.0.2 192.168.0.3
Add together multiple domains or multiple IP addresses in a row to scan multiple hosts at the same time.
nmap 192.168.0.*
Use the * wildcard to scan an entire subnet at once.
nmap 192.168.0.1,two,3
Separate different accost endings with commas rather than typing out the entire IP address.
nmap 192.168.0.i-iv
Use a hyphen to scan a range of IP addresses.
3. Excluding Hosts from Search
When scanning a network, you may want to select an entire group (such as a whole subnet) while excluding a single host.
nmap 192.168.0.* --exclude 192.168.0.2
You can exclude sure hosts from your search using the –exclude flag.
nmap 192.168.0.* --excludefile /file.txt
Yous can also exclude a list of hosts from your search using the –exclude flag and linking to a specific file. This is the easiest way to exclude multiple hosts from your search.
4. Scan to Find out OS Information
In add-on to full general information, Nmap tin can also provide operating arrangement detection, script scanning, traceroute, and version detection. It'southward important to note that Nmap volition do its all-time to identify things like operating systems and versions, but it may not always be entirely authentic.
nmap -A 192.168.0.i
Add in the -A flag on your Nmap control, you can discover the operating system information of the hosts that are mapped. The -A flag tin can be used in combination with other Nmap commands.
nmap -O 192.168.0.1
Using the -O flag on your Nmap command will reveal further operating system information of the mapped hosts. The -O flag enables Bone detection. Additional tags include –osscan-limit and -osscan-guess.
The "–osscan-limit" control volition only guess piece of cake operating system targets. The "-osscan-guess" command will be more ambitious nearly guessing operating systems. Again, operating systems are detected based on certain hallmarks: information technology isn't a certainty that the data is authentic.
5. Scan to Discover Firewall Settings
Detecting firewall settings tin can be useful during penetration testing and vulnerability scans. Several functions tin be used to discover firewall settings across the given hosts, simply the -sA flag is the well-nigh mutual.
nmap -sA 192.168.0.1
Using the sA flag will let you lot know whether a firewall is active on the host. This uses an ACK browse to receive the information.
six. Find Information About Service Versions
At times, you may need to observe service and version data from open ports. This is useful for troubleshooting, scanning for vulnerabilities, or locating services that need to exist updated.
nmap -sV 192.168.0.1
This will give yous the necessary information regarding the services across the given host.
Yous tin can utilise –version-intensity "level" from 0 to 9 to determine the intensity level of this search. You lot can also use –version-trace to bear witness more detailed information of the scan if the scan does not come out with the results that y'all would ordinarily look.
7. Scan for Ports
Port scanning is one of the bones utilities that Nmap offers and consequently, there are a few ways that this command can be customized.
nmap -p 443 192.168.0.1
With the "-p" flag followed by a port, you tin scan for information regarding a specific port on a host.
nmap -p T:8888,443 192.168.0.1
Past adding a type of port earlier the port itself, you can scan for information regarding a specific blazon of connectedness.
nmap -p lxxx,443 192.168.0.1
You can scan for multiple ports with the -p flag by separating them with a comma.
nmap -p 80-443 192.168.0.ane
You can also scan for multiple ports with the -p flag by marking a range with the hyphen. To browse ports in order rather than randomly, add together the flag "-r" to the command.
Yous tin can besides use the control "–acme-ports" followed by a number to find the most common ports, up to that corporeality.
viii. Complete a Scan in Stealth Mode
If information technology is necessary to complete a stealthy scan, utilize the Nmap command:
nmap -sS 192.168.0.one
Using the "-sS" flag will initiate a stealth browse with TCP SYN. The "-sS" flag tin exist used in conjunction with other types of Nmap commands. Withal, this type of scan is slower and may not be equally ambitious every bit other options.
9. Identify Hostnames
There are a few ways you can implement host discovery through Nmap. The nearly mutual of which is through -sL. For example:
nmap -sL 192.168.0.1
The "-sL" flag will find the hostnames for the given host, completing a DNS query for each one. Additionally, the "-north" command tin be used to skip DNS resolution, while the "-R" command can be used to always resolve DNS. The "-Pn" flag will skip host discovery entirely, instead of treating hosts as though they are online regardless.
10. Scan from a File
If y'all have a long listing of addresses that y'all need to browse, you can import a file directly through the command line.
nmap -iL /file.txt
This volition produce a scan for the given IP addresses. In add-on to scanning those IP addresses, yous can besides add other commands and flags. This is useful if there is a set of hosts that you lot often need to reference.
11. Go More Data with Verbose
Verbose output generally gives y'all far more information regarding a command. Sometimes this output is unnecessary. All the same, if y'all're debugging a especially tricky situation or y'all desire more than information, you can set the given command to verbose way.
nmap -5 192.168.0.1
The "-5" flag volition provide additional data almost a completed scan. It tin can be added to most commands to requite more information. Without the "-v" flag, Nmap will generally return but the disquisitional information available.
12. Scan IPv6 Addresses
IPv6 is condign more commonplace, and Nmap supports it but as it supports domains and older IP addresses. IPv6 works with whatsoever of the bachelor Nmap commands. Only, a flag is required to tell Nmap that an IPv6 accost is being referenced.
nmap -6 ::ffff:c0a8:one
Use the -6 command with other flags and commands to perform more than complicated Nmap functions with IPv6.
13. Scan to See Which Servers are Active
I of the near simple abilities for Nmap is the ability to ping agile machines. The "-sP" command locates machines, make sure that machines are responding, or identifies unexpected machines across a network.
nmap -sP 192.168.0.0/24
The "-sP" control will produce a listing of which machines are active and bachelor.
14. Find Host Interfaces, Routes, and Packets
It may become necessary to find host interfaces, print interfaces, and routes to debug.
To practice this, use the iflist command:
nmap --iflist
The "–iflist" command volition produce a listing of the relevant interfaces and routes.
nmap --package-trace
Similarly, "–parcel-trace" volition show packets sent and received, providing like value for debugging.
xv. Aggressive Scans and Timings
Sometimes you may need to browse more aggressively or want to run a quick scan. You can control this through the utilise of the timing mechanisms. In NMAP, timing controls both the speed and the depth of the browse.
nmap -T5 192.168.0.one
An aggressive scan is going to be faster, but it also could exist more disruptive and as well inaccurate. There are other options such as T1, T2, T3, and T4 scans. For most scans, T3 and T4 timings will be sufficient.
16. Become Some Help
If y'all take any questions about Nmap or any of the given commands, you tin can use a tag to go context-based information.
nmap -h
The -h tag volition testify the help screen for Nmap commands, including giving information regarding the available flags.
17. Create Decoys While Scanning
Nmap tin can too exist used to create decoys, which are intended to fool firewalls. While decoys can be used for nefarious purposes, it's by and large used to debug.
nmap -D 192.168.0.1,192.168.0.2,...
When using the -D command, yous tin follow the command with a list of decoy addresses. These decoy addresses will also show as though they are scanning the network, to obfuscate the scan that is actually existence done.
Similarly, information technology's possible to use commands such equally "–spoof-mac" to spoof an Nmap MAC accost, too as the command "-S" to spoof a source address.
Key Takeaways
With the right Nmap commands, you tin can quickly find out information about ports, routes, and firewalls.
Nmap has several settings and flags for a system administrator to explore. In addition to existence able to run in a cloaked mode, initiate decoys, and aggressively and apace scan for potential vulnerabilities.
Was this article helpful?
Yep No
Source: https://phoenixnap.com/kb/nmap-command-linux-examples
0 Response to "in linux,what command using nmap to determine server purpose"
Publicar un comentario