日期:2014-05-17  浏览次数:21232 次

怎样查看外网ip?
电脑是通过公司局域网连接到外网,有什么命令可以直接查看到本台机器的外网ip地址?通过访问那些网页得到的就不用说了。

------解决方案--------------------
以前有了

好像也没什么好办法


------解决方案--------------------
tracert 你公司的域名,看看.
------解决方案--------------------
如果你的网络允许tracert的话,可以用这条命令
C:\> ping -r 1 -n 1 www.163.com

Pinging www.cache.split.netease.com [202.108.9.31] with 32 bytes of data:

Reply from 202.108.9.31: bytes=32 time=917ms TTL=52
Route: 218.24.97.250

Ping statistics for 202.108.9.31:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 917ms, Maximum = 917ms, Average = 917ms

ip Route: 218.24.97.250 这个就是我的外网IP
可以试试
------解决方案--------------------
这时Firefox插件My IP Viewer的代码,将外网ip显示在状态条上,参考一下:
setTimeout( "myipviewer_update() ", 1500); //1.5 secs timeout

function myipviewer_update() {

if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}

xmlhttp.open( "GET ", "http://www.cmyip.com/ ",true);
xmlhttp.onreadystatechange = statusListener;
xmlhttp.send(null);

function statusListener() {
if (xmlhttp.readyState == 1) {
document.getElementById( 'myipviewer_spanel ').label = "loading... ";
}

if (xmlhttp.readyState == 4) {
var data = xmlhttp.responseText;

//Get IP
var pos = data.indexOf( " <h1 ", 0 );
var pos2 = data.indexOf( " </h1> ", 0 );

if (pos > 1){
var IPAddress = data.substring( pos + 46, pos2 ).replace(/^\s*|\s*$/g, " ");
}
if (IPAddress != ' '){
document.getElementById( 'myipviewer_spanel ').label = IPAddress.replace(/^\s*|\s*$/g, " ");
}else{
document.getElementById( 'myipviewer_spanel ').label = "Undefined ";
}

//Get Location
var pos = data.indexOf( "My country is ", 0 );
var pos2 = data.indexOf( " </h2> ", 0 );

if (pos > 1){
var Country = data.substring( pos + 13, pos2 ).replace(/^\s*|\s*$/g, " ");
}
if (Country != ' '){
document.getElementById( 'myipviewer_popup_country ').label = "Country: "+Country.replace(/^\s*|\s*$/g, " ");
}else{
document.getElementById( 'myipviewer_popup_country ').label = "Undefined ";
}

//Get Date
now = new Date();
hour = now.getHours();
min = now.getMinutes();
sec = now.getSeconds();

if (sec < 10){
sec = "0 "+sec;
}
if (min < 10){
min = "0 "+min;
}
if (hour > 12){
hour = hour-12;
}

//Output Update Time
document.getElementById( 'myipviewer_spanel ').setAttribute( "tooltiptext ", "Last updated: " + hour + ": " + min + ": " + sec);

//Set Auto-update Time
setTimeout( "myipviewer_update() ", 600000); //10 Mins
}
}
}

function myipviewer_copyip2clip() {
const gClipboardHelper = Components.classes[ "@mozilla.org/widget/clipboardhelper;1 "]
.getService(Components.interfaces.nsIClipboardHelper);