In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the method of displaying the geographical location of IP under linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "the method of displaying the geographical location of IP under linux".
I. brief introduction
Nali, whose name comes from the Chinese pinyin of "where". Nali contains a set of command-line programs whose main function is to add geolocation information to the output IP strings of some network tools (using the pure database QQWry.Dat). For example, 74.125.128.104 will become 74.125.128.104 [Google in Mountain View, California]. Queries are conducted locally and are not networked, so efficiency does not have any impact on the original command.
The following commands are currently included:
Nalinali-dignali-nslookupnali-traceroutenali-tracepathnali-ping
The premise of using these commands is that their corresponding commands must exist. For example, if you want to use nali-dig, you must make sure that dig exists. Their usage is the same as the original command. For example, nali-dig is used in the same way as dig. (nali-dig is equivalent to dig | nali)
Second, download
# wget-- no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gz
III. Installation
# tar zxvf nali-0.2.tar.gz
# cd nali-0.2
#. / configure
# make & & make install
Update the IP database
You can update the IP database with the nali-update command
/ usr/local/share/QQWry.Dat this file needs to be updated frequently, otherwise the error will be large.
5. Use
5.1. Nali
# nali 74.125.128.106
# nali 61.135.169.105
5.2. Nali-dig
# nali-dig www.google.com
5.3. Nali-nslookup
# nali-nslookup www.google.com
5.4. Nali-traceroute
# nali-traceroute www.google.com
5.5. Nali-tracepath
# nali-tracepath www.baidu.com
5.6. Nali-ping
# nali-ping www.163.com
5.7. Other programs that call nali to display the physical location of IP can use redirection, such as:
# mtr www.google.com | nali
In other words, the nali command can add geographic information to the standard output ip. Similarly, if you don't like using nali-dig, you can also use commands such as dig ip | nali.
VI. Alias
If you find it troublesome to enter nali-xxx, you can do some alias, such as:
# alias traceroute='nali-traceroute'
# alias dig='nali-dig'
VII. Reference
Https://www.surfchen.org/nali
Here are some additions from other netizens:
Nali, whose name comes from the Chinese pinyin of "where".
Nali contains a set of command-line programs whose main function is to add geolocation information to the output IP strings of some network tools (using a pure database).
For example, 218.65.137.1 will become 218.65.137.1 [Guangxi Nanning Telecom].
Queries are conducted locally and will not be networked, so there will be no impact on efficiency.
The following commands are currently included:
Nali
Nali-dig
Nali-nslookup
Nali-traceroute
Nali-tracepath
Nali-ping
The premise of using these commands is that their corresponding commands must exist. For example, if you want to use nali-dig, you must make sure that dig exists. Their usage is the same as the original command. For example, nali-dig is used in the same way as dig.
You may have noticed the command nali, which adds geographic information to the IP string of standard output. The nali-* series of tools are implemented based on this.
download
Wget http://qqwry.googlecode.com/files/nali-0.1.tar.gz installation
. / configure-- prefix=/usr & & make & & make install
Use
1. Count the access records of apache
(you can count which ip has the most visitors and where it comes from):
Command:
Cat / data/log/log_all | awk'{print $1}'| sort | uniq-c | nali | sort-rnk1 | more output:
2303 203.208.60.43 [Beijing Google (China) Company]
1442 61.135.249.210 [Beijing Unicom ADSL]
827 124.207.205.1 [Beijing Telecom]
607 121.14.53.65 [Jiangmen City Telecom, Guangdong Province]
493 117.63.249.59 [Changzhou Telecom, Jiangsu Province]
289 203.208.60.5 [Beijing Google (China) Company]
272 203.208.60.47 [Beijing Google (China) Company]
252 173.66.232.6 [North America]
24061.185.198.110 [Xi'an Telecom ADSL, Shaanxi Province]
217 123.127.8.36 [Beijing Unicom ADSL]
217 113.233.255.7 [Liaoning Unicom]
206 222.76.18.181 [Fuzhou Telecom ADSL, Fujian Province]
19672.30.81.190 [American yahoo spider]
2. Use traceroute
Command:
Nali-traceroute www.google.com
Output result:
Traceroute to www.google.com (72.14.203.147 [Google in Mountain View, California]), 30 hops max, 40 byte packets
61.189.23.129 [Liaoning Unicom] (61.189.23.129 [Liaoning Unicom]) 16.628 ms 16.796 ms 16.891 ms
218.25.16.153 [Tiexi District / Huanggu District Unicom, Shenyang City, Liaoning Province] (218.25.16.153 [Tiexi District / Huanggu District Unicom, Shenyang City, Liaoning Province]) 0.658 ms 0.691 ms 0.685 ms
3 218.61.253.201 [Huludao Unicom, Liaoning Province] (218.61.253.201 [Huludao Unicom, Liaoning Province]) 7.976 ms 8.008 ms 8.001 ms
4 218.61.255.185 [Liaoning Unicom backbone Network] (218.61.255.185 [Liaoning Unicom backbone Network]) 20.614 ms 20.643 ms 20.636 ms
5219.158.9.57 [Beijing Unicom ADSL] (219.158.9.57 [Beijing Unicom ADSL]) 29.274 ms 29.272 ms 29.264 ms
6219.158.3.194 [Beijing Unicom ADSL] (219.158.3.194 [Beijing Unicom ADSL]) 44.582 ms 44.464 ms 44.489 ms
7 219.158.27.118 [Beijing Unicom ADSL] (219.158.27.118 [Beijing Unicom ADSL]) 82.249 ms 82.690 ms 82.648 ms
8 209.85.249.195 [Google in Mountain View, California] (209.85.249.195 [Google in Mountain View, California]) 67.663 ms
209.85.249.192 [Google in Mountain View, California] (209.85.249.192 [Google in Mountain View, California]) 66.336 ms
209.85.249.195 [Google in Mountain View, California] (209.85.249.195 [Google in Mountain View, California]) 68.010 ms
9 209.85.250.90 [Google in Mountain View, California] (209.85.250.90 [Google in Mountain View, California]) 97.320 ms
209.85.250.86 [Google in Mountain View, California] (209.85.250.86 [Google in Mountain View, California]) 112.428 ms
209.85.250.90 [Google in Mountain View, California] (209.85.250.90 [Google in Mountain View, California]) 99.948 ms
10 209.85.243.21 [Google in Mountain View, California] (209.85.243.21 [Google in Mountain View, California]) 96.939 ms
209.85.250.103 [Google in Mountain View, California] (209.85.250.103 [Google in Mountain View, California]) 97.206 ms
209.85.243.21 [Google in Mountain View, California] (209.85.243.21 [Google in Mountain View, California]) 96.935 ms
11 209.85.241.158 [Google in Mountain View, California] (209.85.241.158 [Google in Mountain View, California]) 120.577 ms 120.588 ms 120.543 ms
12 tx-in-f147.google.com (72.14.203.147 [Google Inc., Mountain View, California]) 117.533 ms 117.623 ms 117.651 ms
In other words, the nali command can add geographic information to the standard output ip. Similarly, if you don't like using nali-dig, you can also use commands such as dig ip | nali.
If you find it troublesome to enter nali-xxx, you can do some alias, such as:
Alias traceroute='nali-traceroute'
Alias dig='nali-dig'
At this point, I believe you have a deeper understanding of "the method of displaying the geographical location of IP under linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.