Sometimes I need to find out what the public IP address of a particular machine is. कभी कभी मुझे पता लगाना क्या एक विशेष मशीन के सार्वजनिक आईपी पता है की जरूरत है. If I have access to a web browser on that machine I just hope over to a service such as अगर मैं उस मशीन मैं बस एक सेवा के लिए अधिक उम्मीद है कि इस तरह के रूप में एक वेब ब्राउज़र का उपयोग किया है http://www.whatismyip.com http://www.whatismyip.com or या myip.dk myip.dk to find this information. यह जानकारी प्राप्त करें. However, on a remote Linux server it is not practical to use the web browser method. हालांकि, एक रिमोट लिनक्स सर्वर पर यह व्यावहारिक के लिए वेब ब्राउज़र की विधि का उपयोग नहीं है. So, instead, I use the following hack. तो, के बजाय, मैं निम्नलिखित हैक का उपयोग करें.
I enter the following line into a Linux command line: मैं एक Linux कमांड लाइन में निम्नलिखित पंक्ति दर्ज करें:
# curl -s myip.dk | grep '"Box"' | egrep -o '[0-9.]+' # कर्ल-myip.dk S | 'grep "बॉक्स"' | egrep-o '[0-9.] +'
122.172.9.222 122.172.9.222
Pretty useful stuff this. काफ़ी उपयोगी सामग्री यह. If you need to use this command often it might be a good idea to create a script with the command so that you need not have to remember it. यदि आप इस कमांड का प्रयोग अक्सर यह एक अच्छा विचार करने के आदेश के साथ एक स्क्रिप्ट बनाने की जरूरत है ताकि आप इसे याद नहीं हो सकता है की जरूरत है. Create a new file using your favorite text editor. एक नया अपने पसंदीदा पाठ संपादक का उपयोग कर फ़ाइल बनाएँ. Enter the following lines: निम्नलिखित लाइनों दर्ज करें:
#!/bin/bash ! # / bin / मार
curl -s myip.dk | grep '"Box"' | egrep -o '[0-9.]+' कर्ल-myip.dk S | 'grep "बॉक्स"' | egrep-o '[0-9.] +'
Now save the file as something like /usr/bin/myipaddress . अब ऐसा कुछ के रूप में फ़ाइल सहेजें / usr / bin / myipaddress. Grant it executable privileges like this: यह अनुदान इस तरह निष्पादन योग्य विशेषाधिकार:
# chmod +x /usr/bin/myipaddress # + Chmod x / usr / bin / myipaddress
Now you have a script that you can access from anywhere on your computer by running myipaddress in the command line. अब तुम एक स्क्रिप्ट है कि आप अपने कंप्यूटर पर कहीं से भी कमांड लाइन में myipaddress चलाकर का उपयोग कर सकते हैं. It will output your current public IP address. यह आपके मौजूदा सार्वजनिक आईपी पता उत्पादन होगा. This can be quite useful if you use things like IP-based authentication, or if you use a dynamic DNS service. यह बहुत उपयोगी है अगर आप की तरह बातें आईपी-प्रमाणीकरण आधारित है, या यदि आप एक गतिशील DNS सेवा का उपयोग का प्रयोग हो सकता है.
Although the above example should work most of the time, there might be times when the service that gives you your public IP address is down or has changed the format with which they display the data, thus breaking the script. हालांकि इसके बाद के संस्करण उदाहरण के समय का सबसे अधिक काम करना चाहिए, कई बार ऐसा हो सकता है जब सेवा देता है कि आप अपने सार्वजनिक आईपी पता नीचे है या प्रारूप जिसके साथ वे डेटा का प्रदर्शन बदल गया है, इस प्रकार स्क्रिप्ट को तोड़ने. Here's a backup method in case the command shown earlier does not work for you. यहाँ एक बैकअप विधि है मामले में पहले आप के लिए काम नहीं करता है दिखाया कमान. It used the service यह सेवा का उपयोग किया http://www.formyip.com/ http://www.formyip.com/ . .
# links -dump http://www.formyip.com/ | awk "/IP is/{print $NF}" लिंक #-http://www.formyip.com/ | awk "/ आईपी है / प्रिंट ($ NF) डंप"
You could also use this with lynx : तुम भी लिंक्स के साथ इस इस्तेमाल कर सकते हैं:
# lynx -dump http://www.formyip.com/ | awk "/IP is/{print $NF}" # लिंक्स-http://www.formyip.com/ डंप | / awk "आईपी है / प्रिंट ($ NF)"
Again, feel free to enter this command into a script like I showed you earlier. फिर से, के लिए एक पटकथा में इस कमान में प्रवेश नि: शुल्क लगता है कि मैं तुम्हें पहले से पता चला. It will make using the command a breeze. यह आदेश एक हवा का उपयोग करेंगे.























{ 1 trackback } (1) Trackback
{ 5 comments… read them below or (5 टिप्पणियाँ ... उन्हें या नीचे पढ़ें add one एक जोड़ } )
When I copy-pasted the script into my own file, I saw that your quote marks don't match up. जब मैं कॉपी-मेरी अपनी फ़ाइल में स्क्रिप्ट चिपकाया, मैंने देखा है कि आपके उद्धरण चिह्न अप मैच नहीं है.
… '[0-9.]+' ... '0-9 [.] +'
I changed the first quote before the [ character to ', making the final product read: मैं पहले पहली बोली बदल [चरित्र, जिससे अंतिम उत्पाद पढ़ने 'के लिए:
#!/bin/bash ! # / bin / मार
curl -s myip.dk | grep '"Box"' | egrep -o '[0-9.]+' कर्ल-myip.dk S | 'grep "बॉक्स"' | egrep-o '[0-9.] +'
By the way, I apologize for the slight messiness of this, but it's very difficult to quote a quote mark. वैसे, मैं इस के सा messiness के लिए क्षमा चाहते हैं, लेकिन यह बहुत से एक उद्धरण चिह्न बोली मुश्किल है.
… evidently, the author doesn't read our replies, otherwise, I'd have had a successful execution of the script file, because I would have copied corrected text. ... जाहिर है, लेखक हमारे जवाब पढ़ नहीं है, अन्यथा, मैं स्क्रिप्ट फ़ाइल के सफल निष्पादन किया होगा, क्योंकि मैं पाठ सही होता है नकल की. … ...
Using ifconfig works just as well, you'll still need to grep for the proper lines, and then possibly use sed to extract the actual IP address as this script does, and it doesn't rely on a specific site actually being up… Ifconfig का उपयोग कर बस के रूप में अच्छी तरह से काम करता है, तब भी आप उचित लाइनों के लिए grep की जरूरत है, और तो संभवतः इस कहानी है, और यह एक विशिष्ट साइट पर भरोसा नहीं है के रूप में वास्तविक IP पता निकालने sed उपयोग वास्तव में ऊपर जा रहा है ...
Sorry for the delayed reply. देर से उत्तर के लिए क्षमा करें. You can also use the following command to get your public IP: तुम भी निम्न कमांड का प्रयोग कर अपने सार्वजनिक आईपी प्राप्त कर सकते हैं:
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'You can use आप उपयोग कर सकते हैं
http://www.whatismyip.org/ http://www.whatismyip.org/
To get just the ip in plaintext form. Plaintext के रूप में ही आई पी जाओ.
Leave a Comment एक टिप्पणी छोड़ दो