用浏览器打开该网址: http://whatismyip.org 就可以看到。 如果在linux下没有图形化界面,可以用: curl http://whatismyip.org 也可以得到。 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/75247/showart_1140551.html
局域网的服务器是通过ADSL路由器连接外网的,但ADSL是从ISP运营商那儿通过动态获得ip的,那么我怎么知道自己的外网地址是多少呢? 今天得到几个办法: curl -s http://whatismyip.org wget http://whatismyip.org 然后再 cat index.html 也可以看到 其实我想通过C语言实现直接从路由器上得到这个地址,可我发现从C语言中登录路由十分麻烦。目前还没什么头绪,如果有哪位路过的大侠有更好的办法请告知一下。 小弟在这里谢谢了! ...
通过一些网站抓出来的外网ip,但我去ping,无法ping通,\r\n如果采用ipconfig /all ,以下哪一个地址是我的外网的ip呢?为什么和一些网站获得的都不一样?\r\n Connection-specific DNS Suffix . : bingsoft.com\r\n\r\n Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet\r\n\r\n Physical Address. . . . . . . . . : 00-12-79-C6-69-52\r\n\r\n Dhcp Enabled. . . . . . . . . ...
现在使用iptables 做nat,映射内网端口做为web服务器 具体如下: iptables -t nat -A POSTROUTING -s 0/0 -j MASQUERADE iptables -t nat -A PREROUTING -d 218.110.12.172 -p tcp --dport 80 -j DNAT --to 192.168.0.108:80 iptables -t nat -A POSTROUTING -d 192.168.10.108 -p tcp --dport 80 -j SNAT --to 192.168.0.100:80 其中网关服务器配置双网卡: eth0:218.110.12.172 eth1:192.168.0.100 内部服务器地址为: 192....
我在看一个关于配置squid代理服务器配置教程的时候(以下是教程部分内容) 配置内网ip地址为192.168.0.1 配置外网ip地址为2.2.2.1 网关指向2.2.2.1 配置DNS,使查询www.sohu.com的ip地址为2.2.2.2 #echo 1 > /proc/sys/net/ipv4/ip_forward #iptables -t nat -A PREROUTING -i eth0 -p tcp -s 192.168.0.0/24 --dport 80 -j REDIRECT --to-port 3128 即将来自192.168.0.0/24目的端口为80的数据包重定向到squid监听端口3128 我想请...
def getWanip(): try: data = urllib.urlopen("http://www.sogou.com/features/ip.jsp").read() m=re.search("([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)",data) return m.group() except: raise "getWanip failed"