惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
A
About on SuperTechFans
博客园 - Franky
Engineering at Meta
Engineering at Meta
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
B
Blog
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 叶小钗
Vercel News
Vercel News
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
Last Week in AI
Last Week in AI
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
V
V2EX
G
Google Developers Blog

博客园 - bluce chen

swif debounce实现 oculus quest2的思考 博文阅读密码验证 - 博客园 用户中心 - 博客园 https点对点转发响应示意图 Share架构的一些心得 flutter输入颜色枚举卡顿假死 n2n网络环境搭建 p2p技术之n2n源码核心简单分析一 分享一个14年写的用户管理类-swift版 MIUI通过xposed自动设置root权限 基于xposed实现android注册系统服务,解决跨进程共享数据问题 2017 UICollectionView swift2模版 angularjs 分页精华代码 Reveal分析IOS界面,plist文件读取 php嵌套数组递归搜索返回数组key sqlite3 根据实体自动生成建表语句 prism4 StockTrader RI 项目分析一些体会2
结合阿里云服务器,设置家中jetson tk1随时远程登陆
bluce chen · 2015-02-05 · via 博客园 - bluce chen

前提条件:

1.路由配置dmz主机为tk1的ip ,设置路由器中ssh 端口22的访问权限

2.有一台远程服务器,服务器安装了php可以运行php文件(我使用的是阿里云)

家中tk1配置:

脚本python 部署在jetson tk1上,然后设置crontab 定时执行

把python脚本放在 /jetson/testip.py 

crontab -e 

*/10 * * * * /jetson/testip.py >>/dev/null 2>&1

/*----------------------testip.py-------------------------------*/

#!/usr/bin/python
import re,httplib
conn = httplib.HTTPConnection("1111.ip138.com")
conn.request("GET", "/ic.asp")
r1 = conn.getresponse()
data1 = r1.read()
conn.close()
matchObj = re.search( r'(\d+)\.(\d+)\.(\d+)\.(\d+)', data1, re.M|re.I)
if matchObj:
    ip=matchObj.group()
    conn = httplib.HTTPConnection("remotedIP")
    conn.request("GET", "/testip.php?debug="+ip)
    r1 = conn.getresponse()
    print r1.read()
    conn.close()
else:
    print "error"

2.远程服务器配置,直接在php网站目录下放下面php代码 

/*------------testip.php--------------*/

<?php
$ipfile = "/var/log/homeip.txt";
if (isset($_GET['debug'])) {
	$ip = $_GET['debug'];
	preg_match_all('|\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}|', $ip, $out, PREG_PATTERN_ORDER);
	if (!empty($out[0][0])) {
		$ip = $out[0][0];
	} else {
		die();
	}
	$myfile = fopen($ipfile, "w") or die("Unable to open file!");
	echo ($ip);
	fwrite($myfile, $ip);
	fclose($myfile);
	die();
}
$myfile = fopen($ipfile, "r") or die("Unable to open file!");
echo fread($myfile, filesize($ipfile));
fclose($myfile);
die();

 使用:

http://远程服务器ip/testip.php 

返回得到家中jetson tk1 的公网地址,然后 ssh ip就可以登陆上家里的机器了