http://shouxi.name 2017-01-17T09:27:19+00:00 http://shouxi.name shouxi's blog r@shouxi.name Figure out the list of TCP congestion control algorithms supported by linux 2016-02-22T00:00:00+00:00 http://shouxi.name/blog/2016/02/list-the-currently-supported-tcp-congestion-control-algs-in-ubuntu <p><a href="https://iperf.fr/iperf-doc.php">iperf3</a> allows the client to specify its preferred TCP congestion control algorithm with option <code class="highlighter-rouge">-C</code>. However, the user might be unaware of which algorithms are supported by the running host. It is easy to get the supported list with command</p> <div class="highlighter-rouge"><pre class="highlight"><code>cat /boot/config-(uname -r) | grep CONFIG_TCP_CONG </code></pre> </div> <p>Note that, values <code class="highlighter-rouge">y</code>, <code class="highlighter-rouge">n</code>, and <code class="highlighter-rouge">m</code> stand for <code class="highlighter-rouge">activated</code>, <code class="highlighter-rouge">deactivated</code>, and <code class="highlighter-rouge">activated as module</code>, respectively.</p> <p>In addition, one can figure out the default algorithm employed by the system with command <code class="highlighter-rouge"> cat /proc/sys/net/ipv4/tcp_congestion_control </code></p> <p>Tips: besides <code class="highlighter-rouge">iperf3</code>, the sender can track the real-time state of a TCP connection (e.g., congestion window size) with <a href="http://www.linuxfoundation.org/collaborate/workgroups/networking/tcpprobe">tcp_probe</a>.</p> 为OpenWRT路由器配置新WAN口 2014-08-22T00:00:00+00:00 http://shouxi.name/blog/2014/08/change-wan-port-in-openwrt <p>最近网挂了,今天发现是因为路由器的WAN损坏了,所以打算将一个LAN配置成WAN使用。</p> <p>查资料饶了一圈,最后发现只用在/etc/config/network做一点小修改就ok。 在我手头的设备上,lan口叫做eth2.1, wan口叫做eth2.2, 而他们分别包含哪些port在配置文件后面指定, 如下所示: ``` config switch option name ‘rt305x’ option reset ‘1’ option enable_vlan ‘1’</p> <p>config switch_vlan option device ‘rt305x’ option vlan ‘1’ option ports ‘1 2 3 4 5 6t’</p> <p>config switch_vlan option device ‘rt305x’ option vlan ‘2’ option ports ‘0 6t’ ```</p> <p>最后两个switch_vlan配置里面的0-6代表的是6个port, ‘6t’ 代表数据包从vlan的这个port出去时候,会被打上标签,一般代表接cpu那个port, 参考<a href="http://wiki.openwrt.org/doc/uci/network/switch">这里</a>, 有图有真相。 从这个配置可以断定,这台路由器上port 0是原来的wan口,port6接着cpu端,1-5应该是 4 lan port + 1 unused port。 由于还是不知编号和路由器上端口的具体对应关系,所以直接挨个尝试了一下。发现1-4应该分别对应路由器上的LAN4,LAN3,LAN2,LAN1。</p> <p>最终打算用LAN4作为WAN使用,由此吧option ports那两行分别改成: <code class="highlighter-rouge"> option ports '2 3 4 5 6t' option ports '1 6t' </code> 即可。</p> <p>参考<a href="http://pbforfoss.com/openwrt/2014/03/14/openwrt-vlan.html">内容</a></p> <p>这个路由器先前刷的OpenWRT-DreamBox,到现在web页面部分设置项的页面都挂了,所以这次干脆新刷个OpenWRT-PandoraBox,之前的配置文件忘了考出来,再次安装wpa_supplicant, openvpn, 配置vpn的时候又遇到之前遇到过的一些繁琐问题, 这次记录下来备忘。</p> <h3 id="cpu">问题1: 安装的软件与路由CPU芯片架构不匹配</h3> <p>用非默认的PACKAGES源安装软件或者opkg update的时候会出现 <code class="highlighter-rouge"> Package XXX version XXXX has no valid architecture, ignoring. </code> 解决办法: 在OPKG的配置里面加入(比如我的HG255D) <code class="highlighter-rouge"> arch all 100 arch noarch 200 arch ralink 200 arch ramips 300 </code></p> <h3 id="md5summismatch">问题2: 出现md5sum+mismatch不匹配提示</h3> <p>在安装本地上传的IPK的时候,经常会出现md5sum+mismatch不匹配提示。这是因为原有的PACKAGES源与你下载回来的IPK版本不一致,一般是下载回来的版本比较新。 在OPKG的配置里面注释掉PACKAGES源(在最前面加上#),如</p> <div class="highlighter-rouge"><pre class="highlight"><code># src/gz src/gz attitude_adjustment http://downloads.openwrt.org/attitude_adjustment/12.09/ramips/rt305x/packages </code></pre> </div> <p>再执行opkg install xxx.ipk 如果是kmod类的安装包,可能需要在后面加–force-depends进行强制安装。</p> <p>PS,这个两个问题的方案来自<a href="http://wayjam.me/post/two-problems-about-install-package-on-openwrt.md">WayJam的博文</a></p> <h3 id="vpnlanvpn">问题3:路由器成功接入vpn,但LAN口进来的数据没有经过vpn。</h3> <p>可能是iptables设置问题,在/etc/firewall.user配置中加入一下配置即可。(多谢祥哥提醒)</p> <div class="highlighter-rouge"><pre class="highlight"><code># Internal uci firewall chains are flushed and recreated on reload, so # put custom rules into the root chains e.g. INPUT or FORWARD or into the iptables -I FORAWARD -o br-lan -j ACCEPT iptables -I FORWARD -o tun0 -j ACCEPT iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE </code></pre> </div> LaTeXTools 'No bib files found' Error 2013-11-16T00:00:00+00:00 http://shouxi.name/blog/2013/11/SublimeText-LaTeXTools-cite-tips <p>把文本编辑器从<a href="http://www.everedit.net/">EverEdit</a>换成了<a href="http://www.sublimetext.com/">SublimeText 3</a>。 装上<a href="https://github.com/SublimeText/LaTeXTools">LatexTool</a>过后写latex十分方便,使用\ref, \cite等命令时还会自动补全提示。</p> <p>但在latex码字过程中,如果对latex文件进行了拆分,使用\include一类的命令包含到一个主tex文件中。 由于子文件里面没有使用\bibliography之类的命令包含bib文件,因此在子文件中使用\cite时会提示<strong><em>No bib files found</em></strong>的错误。 翻了一下LatexTool源码里面实现bib文件查找的代码(python实现)</p> <p>发现是LatexTool每次输入\cite{会触发一个叫<a href="https://github.com/SublimeText/LaTeXTools/blob/master/latex_cite_completions.py">latex_cite_completions.py</a>的python代码,读取本tex文件以及它\include进来的文件中\bibliography和\addbibresource语句所指定的bib文件, 获得bib item信息。</p> <p>因此,在这些子文件中,可以伪造一个无用\bibliography语句来骗LatexTool。 比如加一句:</p> <div class="highlighter-rouge"><pre class="highlight"><code>\iffalse \bibliography{../mybibfile.bib} \fi </code></pre> </div> <p>。</p> <p>由于latex_cite_completions.py在读取tex文件时,会进行预处理,把%打头的字符串忽略掉, 但有个诡异的bug:在处理有些文件时会把%后面的所有后文都忽略,导致出现在%以后的\bibliography也漏掉了。 因此加在tex文件的前面比较稳妥。</p> Header space analysis系列论文阅读笔记 2013-10-24T00:00:00+00:00 http://shouxi.name/blog/2013/10/header-space-analysis-notes <p>Stanford的头空间分析(Header space analysis)的一些列文章很有意思, 实验室兴趣小组内交流时做了ppt分享,在<a href="http://sdrv.ms/1cjsAVS">这儿</a>做个备份。</p> <p>[1] P. Kazemian, G. Varghese, and N. McKeown. Header space analysis: static checking for networks. NSDI 2012.</p> <p>[2] P. Kazemian, M. Chang, H. Zeng, G. Varghese, N. McKeown, and S. Whyte. Real time network policy checking using header space analysis. NSDI 2013.</p> <p>[3] H. Zeng, P. Kazemian, G. Varghese, and N. McKeown. Automatic Test Packet Generation. CoNEXT 2012.</p> git修改历史 2013-10-24T00:00:00+00:00 http://shouxi.name/blog/2013/10/git-tips <ul> <li> <p>用git filter-branch修改所有commit的name and email。 ` git filter-branch -f –env-filter “GIT_AUTHOR_NAME=’Newname’; GIT_AUTHOR_EMAIL=’newemail’; GIT_COMMITTER_NAME=’Newname’; GIT_COMMITTER_EMAIL=’newemail’;” HEAD `</p> </li> <li> <p>撤销提交 <code class="highlighter-rouge">git reset</code></p> </li> <li> <p>删除一个文件及其历史记录 <a href="https://help.github.com/articles/remove-sensitive-data">link</a></p> </li> <li> <p>还找到一个东西,叫做<a href="http://www.oschina.net/news/26598/10-things-i-hate-about-git">我痛恨Git的10个理由</a></p> <p>ref: <a href="http://loveky2012.blogspot.com/2012/08/git-command-git-filter-branch.html">1</a> <a href="http://git-scm.com/book/zh">2</a> <a href="http://gitbook.liuhui998.com/">3</a></p> </li> </ul> SDN与网络虚拟化 2013-09-01T00:00:00+00:00 http://shouxi.name/blog/2013/09/sdn-and-network-virtualization <p>7月底去某研究所交流,做了一个十分简单的ppt分享我们对SDN与网络虚拟化的理解。<a href="http://sdrv.ms/1afT9cX">slides download</a></p> 数据平面与控制平面 2013-04-06T00:00:00+00:00 http://shouxi.name/blog/2013/04/dataplane-vs-controlplane <p>之前看SDN/OpenFlow材料时,一直对<strong>数据平面</strong>和<strong>控制平面</strong>这两个概念很困惑, 对于”<strong>控制平面</strong>和<strong>控制平面</strong>处理的对象分布是什么?”这样的一个问题没有一个简洁的答案。 今天看到nick “CS244: Advanced Topics in Networking, Winter 2013”的 <a href="http://www.stanford.edu/class/cs244/2013/timetable.html">课件</a>上的解释简洁明了:</p> <p>Network elements:</p> <ul> <li>Data plane: packets</li> <li>Control plane: events</li> <li>Management: policies</li> </ul> <p>而对于”<strong>数据平面</strong>和<strong>控制平面</strong>是什么?”,可以用Composing Software-Defined Networks(NSDI 13)里的解释来回答:</p> <ul> <li>control plane: determines rules</li> <li>data plane: applies rules to packets</li> </ul> run kvm on linux without x server 2012-08-03T00:00:00+00:00 http://shouxi.name/blog/2012/08/kvm-on-nox-linux <p>I installed kvm on a ubuntu 12.04 server which does not have x server.</p> <p>When starting an existing virtual machine(file ended with .wmdk), I get error message:</p> <blockquote> <p>Could not initialize SDL(No available video device) - exiting</p> </blockquote> <p>add the parameters</p> <blockquote> <p>-vga std -k en-us -vnc :1</p> </blockquote> <p>at the end of the cmd may avoid this error.&lt;/p&gt; </p> SDN/OpenFlow火吗? 2012-07-31T00:00:00+00:00 http://shouxi.name/blog/2012/07/popularity-of-openflow-sdn <p>在微软学术搜索(<a href="http://academic.research.microsoft.com/">microsoft academic search</a>) 和谷歌学术搜索(<a href="http://scholar.google.com/">Google scholar search</a>)分别以OpenFlow 和software-defined network(SDN)为关键字搜索文章,统计发表于2001到2011年间到的文章数量,结果如下 (搜索时间:2012.07.31):</p> <p><img src="/media/img/2012-p-of-openflow.png" alt="img1" /></p> <p><img src="/media/img/2012-p-of-sdn.png" alt="img2" /></p> 临时设置LaTex段落颜色 2012-07-26T00:00:00+00:00 http://shouxi.name/blog/2012/07/set-paragraph-color-in-latex <p>\usepackage{color}</p> <p>then use</p> <p>{\color{red}the text which you want set color}</p> MapReduce火吗? 2012-07-12T00:00:00+00:00 http://shouxi.name/blog/2012/07/popularity-of-mapreduce <p>在微软学术搜索(<a href="http://academic.research.microsoft.com/">microsoft academic search</a>) 上以MapReduce为关键字搜索文章,统计发表于2001到2011年间到的文章数量,结果如下(搜索时间:2012.07.21):</p> <p><img src="http://shouxi.name/media/img/2012-p-of-mapreduce.png" alt="img" /></p> <p>备注:</p> <p>MapReduce由Google在2004年的OSDI会议上首次公开提出(MapReduce: Simplified Data Processing on Large Clusters)。</p>