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

推荐订阅源

雷峰网
雷峰网
爱范儿
爱范儿
宝玉的分享
宝玉的分享
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
博客园 - 聂微东
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 叶小钗
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
博客园 - 司徒正美
博客园 - 【当耐特】
IT之家
IT之家

Rc-2020 on Julia Evans

Day 57: Trying to set up GitHub Actions Day 56: A little WebAssembly Day 53: a little nginx, IPv6, and wireguard Day 52: testing how many Firecracker VMs I can run Day 51: Fixed my logging and made a couple of puzzles Day 50: Building some tarballs for puzzles, and trying to make a kernel boot faster Day 49: making the VMs boot faster Day 48: Another Go program, and a little vim configuration Day 47: Using device mapper to manage Firecracker images Day 44: Building my VMs with Docker Day 43: Building VM images Day 42: Writing a Go program to manage Firecracker VMs Day 41: Trying to understand what a bridge is Day 40: screen flickering & a talk about containers Day 39: Customizing gotty's terminal Day 38: Modifying gotty to serve many different terminal applications at once Day 37: A new laptop and a little Vue Day 35: Launching my VMs more reliably Day 34: Learning about qemu Day 33: pairing is magic and beautiful git diffs Day 32: A Rails model that doesn't use the database with ActiveHash Day 24: a short talk about blogging myths, and a debugging tip Day 23: a little Rails testing Day 22: getting OAuth to work in Rails Day 21: wrangling systemd & setting up git deploys to a VM Day 19: Clustering faces (poorly) using an autoencoder Day 20: trying to figure out how Google Cloud IAM works Day 18: an answer to an autoencoder question Day 17: trying to wrap my head around autoencoders Day 13: BPTT, and debugging why a model isn't training is hard
Day 46: debugging an iptables problem
Julia Evans · 2021-01-26 · via Rc-2020 on Julia Evans

I spent a lot of my brain energy yesterday debugging an iptables mystery.

the iptables mystery

I needed to be able to ping the host’s IP (like 192.168.1.23) from inside a container. This was working 100% totally fine on my laptop. Then I tried the exact same thing on my server, and it didn’t work at all!

At first I thought that maybe I didn’t understand something about how bridges work, and I spent some time reading about bridges. I think I learned a tiny bit more about bridges but this didn’t really help.

Then Kamal said “well, maybe it’s iptables” and so I spent some time looking into that. I really didn’t think it was iptables because I didn’t think there were any special iptables rules except the Docker rules, and the Docker rules were working fine on my laptop.

some adventures in iptables tracing

I tried to trace some specific iptables rules that I thought might potentially be the problem (with -j TRACE) following this very good blog post How do I see what iptables is doing?

This ultimately didn’t really help, but at some point that blog post suggested running iptables -L -n -v --line-numbers and I noticed something!!!

what was happening: iptables was dropping some packets

When I ran iptables -L -n -v and I saw something like this:

$ iptables -L -n -v 
Chain INPUT (policy DROP 2 packets, 120 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   18  1288 ufw-before-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
   18  1288 ufw-before-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    2   120 ufw-after-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    2   120 ufw-after-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    2   120 ufw-reject-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    2   120 ufw-track-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0         

policy DROP 2 packets! That is suspicious! I double checked that this was 100% definitely the problem by running iptables -Z to reset all of iptables' counts and tried again. Same result! Hooray!

I looked into these ufw rules and I found out that ufw is a firewall that often gets installed in Ubuntu machines. I tried to track down which exact rule was causing the problem, but I didn’t really figure it out.

But I tried completely disabling the firewall with ufw disable, and it fixed the problem!

solution: disable the ufw firewall

DigitalOcean comes with an external firewall anyway and I didn’t really see why I also needed an extra iptables firewall running on my machine, so I decided to just run ufw disable to disable that firewall completely.

I added some extra rules to the external firewall to block all TCP ports except 22 and 80.

some experiments with ignite

On the weekend I spent some time experimenting with reimplementing my Firecracker VM API using ignite.

So far I’ve learned that:

  • ignite turns Docker containers into VM images
  • it uses dmsetup to set up a device mapper so that it doesn’t need to make a copy of the image every time it starts a VM
  • this doesn’t mean that 2 images that share some container layers share space on disk though – for every different tag it makes a copy of the whole image

I wrote a hacky HTTP API ignite-manager.go that just shells out to the ignite command line tool a lot.

working on startup speed

Right now the Ignite VMs are taking 15-20 seconds to start on my DigitalOcean droplet. I think this is kind of too slow (I want to be done in 5 seconds at most!) so I’m going to spend some more time learning about this device mapper thing.