<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Iptables on Ricky</title><link>https://linzeyan.github.io/categories/iptables/</link><description>Recent content in Iptables on Ricky</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 04 Dec 2019 11:08:04 +0800</lastBuildDate><atom:link href="https://linzeyan.github.io/categories/iptables/index.xml" rel="self" type="application/rss+xml"/><item><title>Load Balancing with iptables and ip rule</title><link>https://linzeyan.github.io/posts/2019/20191204-ip-tables-rule-load-balance/</link><pubDate>Wed, 04 Dec 2019 11:08:04 +0800</pubDate><guid>https://linzeyan.github.io/posts/2019/20191204-ip-tables-rule-load-balance/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://blog.outv.im/2019/ip-tables-rule-load-balance/" target="_blank" rel="noopener">Load Balancing with iptables and ip rule&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="steps">Steps&lt;/h4>
&lt;p>This example uses an Arch Linux device with two Internet uplinks: eth0 and eth1. The mapping is:&lt;/p>
&lt;ul>
&lt;li>Mark 10 (0xa) - Routing table #110 - use eth0&lt;/li>
&lt;li>Mark 11 (0xb) - Routing table #111 - use eth1&lt;/li>
&lt;/ul>
&lt;p>We decide which uplink to use based on the packet mark. First, use ip rule to map each mark to its routing table.&lt;/p>
&lt;p>The default routing table priority is 32768. To ensure our tables are used, set a higher priority (for example 31000).&lt;/p></description></item><item><title>Fighting ISP Cache Hijacking Again with iptables</title><link>https://linzeyan.github.io/posts/2019/20191007-fuck-cmcc/</link><pubDate>Mon, 07 Oct 2019 10:41:08 +0800</pubDate><guid>https://linzeyan.github.io/posts/2019/20191007-fuck-cmcc/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://v2c.tech/Article/FUCK-CMCC" target="_blank" rel="noopener">Fighting ISP Cache Hijacking Again with iptables&lt;/a>&lt;/li>
&lt;/ul>
&lt;h5 id="cause">Cause&lt;/h5>
&lt;p>The fight against the carrier cache problem started two years ago. The carrier even cached cnpm data. Worse, their cache servers were not only slow like a turtle in a marathon, they also crashed frequently, so I just wanted to write code but had to face a wall of red errors.&lt;/p>
&lt;h5 id="fix">Fix&lt;/h5>
&lt;p>&lt;code>iptables -I FORWARD -p tcp -m tcp -m ttl --ttl-gt 20 -m ttl --ttl-lt 30 -j DROP&lt;/code>&lt;/p></description></item></channel></rss>