-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
94 lines (56 loc) · 19.5 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>玩转互联网技术</title>
<subtitle>互联网、前端、后台</subtitle>
<link href="/atom.xml" rel="self"/>
<link href="https:chenyulun.github.io/"/>
<updated>2017-11-24T03:37:48.615Z</updated>
<id>https:chenyulun.github.io/</id>
<author>
<name>chenyulun</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>mac添加路由方法</title>
<link href="https:chenyulun.github.io/2017/11/24/mac-route/"/>
<id>https:chenyulun.github.io/2017/11/24/mac-route/</id>
<published>2017-11-24T01:43:37.000Z</published>
<updated>2017-11-24T03:37:48.615Z</updated>
<content type="html"><![CDATA[<p>由于公司启用内网,又需要访问外网,就需要用户手动设置转发路由,才能愉快的同时使用内外,不需要切换网络</p><h4 id="查看当前路由表"><a href="#查看当前路由表" class="headerlink" title="查看当前路由表"></a>查看当前路由表</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -rn</span><br></pre></td></tr></table></figure><h4 id="获取默认路由"><a href="#获取默认路由" class="headerlink" title="获取默认路由"></a>获取默认路由</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">route get 0.0.0.0</span><br></pre></td></tr></table></figure><a id="more"></a><h4 id="删除默认路由"><a href="#删除默认路由" class="headerlink" title="删除默认路由"></a>删除默认路由</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo route -n delete default 10.2.0.1</span><br></pre></td></tr></table></figure><h4 id="添加公网网关"><a href="#添加公网网关" class="headerlink" title="添加公网网关"></a>添加公网网关</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo route add -net 0.0.0.0 10.2.0.1</span><br></pre></td></tr></table></figure><h4 id="添加内网网关"><a href="#添加内网网关" class="headerlink" title="添加内网网关"></a>添加内网网关</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo route add -net 194.0.0.0 194.2.100.254</span><br></pre></td></tr></table></figure><p>内外网同时访问方法:<br>前提是有两张网卡,一般机器都有,一个有线,一个无线。<br>改变路由表,默认走外网网卡,指定的内网地址才走内网网卡。<br><strong>注意网卡要先链接再设置,拔掉一个其中一个失效的话需要重新设置</strong></p><p>查看路由表:<br>netstat -nr</p><p>查看默认路由:<br> route get 0.0.0.0</p><p>先删掉不想用的内网默认路由:<br>sudo route -n delete default 172.18.2.254</p><p>再重新添加需要的默认路由,一般是走公网的网关:<br>sudo route add -net 0.0.0.0 192.168.191.1</p><p>4、设置HOSTS文件<br>由于OA网段是一台双网卡PC共享的,无法进行DNS,好在OA的网址不多,全部写入HOSTS文件<br>打开【Finder】-前往【前往文件夹…】–【/etc】<br>编辑HOSTS文件:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># 注释</span><br><span class="line">10.1.x.x xxx.xxx.xx</span><br><span class="line">10.9.x.x xxx.xxx.xxx</span><br><span class="line">10.221.x.x xxx.xxx.xxx</span><br><span class="line"># Mail 服务器</span><br><span class="line">172.x.x.x mail.x.x</span><br></pre></td></tr></table></figure></p><p>修改HOSTS涉及到权限,可用多种方法自行处理</p><p>5、再加上内网的路由,到内网服务器地址,走内网网关:<br>sudo route -n add -net 10.1.0.0/16 192.168.0.1<br>sudo route -n add -net 10.9.0.0/16 192.168.0.1<br>sudo route -n add -net 10.221.0.0/16 192.168.0.1<br>sudo route -n add -net 172.x.x.x/32 192.168.0.1</p><p>6、把上面代码写入到程序里面方便网卡重启或者机器重启之后的设置;<br>在MAC OS X自带了【Automator】工具,下面就介绍下怎样使用【Automator】实现重启自动添加路由<br>打开【launchpad】-【其他】-【Automator】<br>选取文稿类型:应用程序<br>左边点选【资源库】-【实用工具】<br>列表中选取【运行AppleScript】<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">右边的脚本框中如下编辑脚本:</span><br><span class="line">on run {input, parameters}</span><br><span class="line"></span><br><span class="line"> do shell script &quot;route -n add -net 10.1.0.0/16 192.168.0.1&quot; user name &quot;你登陆系统的用户名&quot; password &quot;你登陆系统的密码&quot; with administrator privileges</span><br><span class="line"> do shell script &quot;route -n add -net 10.9.0.0/16 192.168.0.1&quot; user name &quot;你登陆系统的用户名&quot; password &quot;你登陆系统的密码&quot; with administrator privileges</span><br><span class="line"> do shell script &quot;route -n add -net 10.221.0.0/16 192.168.0.1&quot; user name&quot;你登陆系统的用户名&quot; password &quot;你登陆系统的密码&quot; with administrator privileges</span><br><span class="line"> do shell script &quot;route -n add -net 172.x.x.x/32 192.168.0.1&quot; user name &quot;你登陆系统的用户名&quot; password &quot;你登陆系统的密码&quot; with administrator privileges</span><br><span class="line"></span><br><span class="line"> return input</span><br><span class="line">end run</span><br></pre></td></tr></table></figure></p><p>然后保存为OA_Route.app</p><p>最后,打开【系统偏好设置】-【用户与群组】-选【登录项】,将刚才保存的OA_Route.app拖到列表中,并勾选隐藏<br>详细设置参考地址: <a href="http://bbs.feng.com/read-htm-tid-5138570.html" target="_blank" rel="noopener">http://bbs.feng.com/read-htm-tid-5138570.html</a><br>linux route命令的使用详解: <a href="https://www.cnblogs.com/snake-hand/p/3143041.html" target="_blank" rel="noopener">https://www.cnblogs.com/snake-hand/p/3143041.html</a></p>]]></content>
<summary type="html">
<p>由于公司启用内网,又需要访问外网,就需要用户手动设置转发路由,才能愉快的同时使用内外,不需要切换网络</p>
<h4 id="查看当前路由表"><a href="#查看当前路由表" class="headerlink" title="查看当前路由表"></a>查看当前路由表</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -rn</span><br></pre></td></tr></table></figure>
<h4 id="获取默认路由"><a href="#获取默认路由" class="headerlink" title="获取默认路由"></a>获取默认路由</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">route get 0.0.0.0</span><br></pre></td></tr></table></figure>
</summary>
<category term="mac" scheme="https:chenyulun.github.io/categories/mac/"/>
<category term="mac" scheme="https:chenyulun.github.io/tags/mac/"/>
<category term="网络" scheme="https:chenyulun.github.io/tags/%E7%BD%91%E7%BB%9C/"/>
<category term="route命令" scheme="https:chenyulun.github.io/tags/route%E5%91%BD%E4%BB%A4/"/>
</entry>
<entry>
<title>Mac OSX下给树莓派安装Raspbian系统</title>
<link href="https:chenyulun.github.io/2017/11/22/%E6%A0%91%E8%8E%93%E6%B4%BE%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85/"/>
<id>https:chenyulun.github.io/2017/11/22/树莓派系统安装/</id>
<published>2017-11-22T09:56:24.000Z</published>
<updated>2017-11-23T06:33:00.207Z</updated>
<content type="html"><![CDATA[<p>先到<a href="http://www.raspberrypi.org/downloads" target="_blank" rel="noopener">树莓派的官方网站</a>去下载一个系统镜像<br>下载完成后得到一个img镜像:2017-09-07-raspbian-stretch.img<br>插入SD卡,用df命令查看当前已挂载的卷:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:JavaVirtualMachines tusm$ df -h</span><br><span class="line">Filesystem Size Used Avail Capacity iused ifree %iused Mounted on</span><br><span class="line">/dev/disk1s1 238Gi 182Gi 52Gi 78% 3875345 9223372036850900462 0% /</span><br><span class="line">devfs 195Ki 195Ki 0Bi 100% 675 0 100% /dev</span><br><span class="line">/dev/disk1s4 238Gi 3.0Gi 52Gi 6% 3 9223372036854775804 0% /private/var/vm</span><br><span class="line">map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net</span><br><span class="line">map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home</span><br><span class="line">/dev/disk2s1 60Gi 8.6Mi 60Gi 1% 69 488354 0% /Volumes/未命名</span><br></pre></td></tr></table></figure></p><a id="more"></a><p>对比Size和Name可以找到SD卡的分区在系统里对应的设备文件(这里是/dev/disk2s1),如果你有多个分区,可能还会有disk1s1之类的。使用diskutil unmount将这些分区卸载:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:JavaVirtualMachines tusm$ diskutil unmount /dev/disk2s1</span><br><span class="line">Volume 未命名 on disk2s1 unmounted</span><br></pre></td></tr></table></figure></p><p>通过diskutil list来确认设备:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:JavaVirtualMachines tusm$ diskutil list</span><br><span class="line">/dev/disk0 (internal, physical):</span><br><span class="line"> #: TYPE NAME SIZE IDENTIFIER</span><br><span class="line"> 0: GUID_partition_scheme *256.1 GB disk0</span><br><span class="line"> 1: EFI EFI 209.7 MB disk0s1</span><br><span class="line"> 2: Apple_APFS Container disk1 255.9 GB disk0s2</span><br><span class="line"></span><br><span class="line">/dev/disk1 (synthesized):</span><br><span class="line"> #: TYPE NAME SIZE IDENTIFIER</span><br><span class="line"> 0: APFS Container Scheme - +255.9 GB disk1</span><br><span class="line"> Physical Store disk0s2</span><br><span class="line"> 1: APFS Volume mac os 195.8 GB disk1s1</span><br><span class="line"> 2: APFS Volume Preboot 21.0 MB disk1s2</span><br><span class="line"> 3: APFS Volume Recovery 518.1 MB disk1s3</span><br><span class="line"> 4: APFS Volume VM 3.2 GB disk1s4</span><br><span class="line"></span><br><span class="line">/dev/disk2 (external, physical):</span><br><span class="line"> #: TYPE NAME SIZE IDENTIFIER</span><br><span class="line"> 0: FDisk_partition_scheme *64.0 GB disk2</span><br><span class="line"> 1: Windows_NTFS 未命名 64.0 GB disk2s1</span><br></pre></td></tr></table></figure></p><p>切换到镜像目录文件夹如:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:JavaVirtualMachines tusm$ cd ~/Downloads/</span><br></pre></td></tr></table></figure></p><p>使用dd命令将系统镜像写入,需要特别特别注意disk后的数字,不能搞错!<br>(说明:/dev/disk2s1是分区,/dev/disk2是块设备,/dev/rdisk2是原始字符设备)<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:Downloads tusm$ sudo dd bs=4m if=2017-09-07-raspbian-stretch.img of=/dev/rdisk2</span><br></pre></td></tr></table></figure></p><p>经过几分钟的等待,出现下面的提示,说明SD卡刷好了:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">1172+1 records in</span><br><span class="line">1172+1 records out</span><br><span class="line">4916019200 bytes transferred in 642.569513 secs (7650564 bytes/sec)</span><br></pre></td></tr></table></figure></p><p>用diskutil unmountDisk卸载设备:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:Downloads tusm$ sudo diskutil unmountDisk /dev/disk2</span><br><span class="line">Unmount of all volumes on disk2 was successful</span><br></pre></td></tr></table></figure></p><p>现在就可以拔下SD卡,插到树莓派上启动系统了。第一次启动会进入Raspi-config,后面配置方法同其他平台一样,参考使用<a href="http://shumeipai.nxez.com/2013/09/07/raspi-config-configuration-raspberry-pie.html" target="_blank" rel="noopener">raspi-config配置树莓派</a>即可。</p>]]></content>
<summary type="html">
<p>先到<a href="http://www.raspberrypi.org/downloads" target="_blank" rel="noopener">树莓派的官方网站</a>去下载一个系统镜像<br>下载完成后得到一个img镜像:2017-09-07-raspbian-stretch.img<br>插入SD卡,用df命令查看当前已挂载的卷:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">tusmdeMacBook-Pro-2:JavaVirtualMachines tusm$ df -h</span><br><span class="line">Filesystem Size Used Avail Capacity iused ifree %iused Mounted on</span><br><span class="line">/dev/disk1s1 238Gi 182Gi 52Gi 78% 3875345 9223372036850900462 0% /</span><br><span class="line">devfs 195Ki 195Ki 0Bi 100% 675 0 100% /dev</span><br><span class="line">/dev/disk1s4 238Gi 3.0Gi 52Gi 6% 3 9223372036854775804 0% /private/var/vm</span><br><span class="line">map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net</span><br><span class="line">map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home</span><br><span class="line">/dev/disk2s1 60Gi 8.6Mi 60Gi 1% 69 488354 0% /Volumes/未命名</span><br></pre></td></tr></table></figure></p>
</summary>
<category term="树莓派" scheme="https:chenyulun.github.io/categories/%E6%A0%91%E8%8E%93%E6%B4%BE/"/>
<category term="树莓派" scheme="https:chenyulun.github.io/tags/%E6%A0%91%E8%8E%93%E6%B4%BE/"/>
</entry>
<entry>
<title>开通博客</title>
<link href="https:chenyulun.github.io/2017/11/22/%E5%BC%80%E9%80%9A%E5%8D%9A%E5%AE%A2/"/>
<id>https:chenyulun.github.io/2017/11/22/开通博客/</id>
<published>2017-11-22T08:50:19.000Z</published>
<updated>2017-11-22T09:47:07.332Z</updated>
<content type="html"><![CDATA[<h4 id="你好-欢迎来到我的个人技术博客"><a href="#你好-欢迎来到我的个人技术博客" class="headerlink" title="你好!欢迎来到我的个人技术博客"></a>你好!欢迎来到我的个人技术博客</h4>]]></content>
<summary type="html">
<h4 id="你好-欢迎来到我的个人技术博客"><a href="#你好-欢迎来到我的个人技术博客" class="headerlink" title="你好!欢迎来到我的个人技术博客"></a>你好!欢迎来到我的个人技术博客</h4>
</summary>
<category term="其他" scheme="https:chenyulun.github.io/categories/%E5%85%B6%E4%BB%96/"/>
<category term="日常闲谈" scheme="https:chenyulun.github.io/tags/%E6%97%A5%E5%B8%B8%E9%97%B2%E8%B0%88/"/>
</entry>
</feed>