Iptables Stateful Firewall and NAT Routing

Network packet filtering! Whether is your home or your company, modern networks have many systems connected. Even a small domestic network can provide connectivity to many devices of different kinds: PCs, laptops, printers, smartphones, game consoles, your neighbor’s laptop (wait… what?!), NASes, media players, TVs…

If you have some basic knowledge in networking, you’ll probably want a way to control all the traffic going through your network, and if you are running a GNU/Linux system, you probably already have what you need… Netfilter!

What you’ll find here are some examples of common Netfilter (iptables) configurations and some scripts I use as a base for my firewalls and network installations.

These are really useful if you need some advanced firewall configuration and you choose to run your own GNU/Linux system as a router instead of a commercial one. Also, these scripts may come in handy if you need to quickly replace a broken router with a spare PC.

Read more of this post

USB Key AVR Programmer

So, you saw some AVR microcontrollers and you decided they are cute (they really are!). If you choose to work in plain C what you need is just a toolchain (you probably have some package ready for your distribution), the avr-libc library, a programming software like avrdude and a hardware programmer!

While you can freely download all the software you need, including the source code, for the programming hardware you have to choose between buying a commercial programmer (either from Atmel or some third party) and building your own.

What I’m publishing in this post is my version of the popular USBasp, an open source USB AVR programmer design from Thomas Fischl.

My version is a USB key-like design, using many SMD parts and a very small PCB. You can take it with you everywhere!

Read more of this post

Using Serial Ports on GNU/Linux Systems

While for the modern PC user serial ports are just a page on Wikipedia, for the embedded developer a 3 wire UART can be a simple point-to-point bus, or even the only way you have to access the debug data of the system.

Serial ports are almost always used in SoC based designs as the bus to access the bootloader command prompt and the debugging console, and is not uncommon to find SoC with 5 or more serial ports. Also, many peripherals communicate with the main processor via UARTs, such as GPS, GSM modems, Bluetooth radio, field bus devices and general purpose microcontrollers.

On a GNU/Linux system, a serial port is just a character device file, which can be opened, written, read and closed. However, to properly use the device from a C application, you have to use a certain command sequence, which can be quite tricky if you never did it before.

Read more of this post

Five Port Fast Ethernet Managed Switch

This project is the complete design of a 5 port fast Ethernet switch, based on the Micrel KSZ8995M switch IC with integrated PHY and an ATMega168 8-bit microcontroller.

The hardware was originally developed in 2009, because I needed a compact, VLAN capable switch to expand the functionality of an NSLU2, which has just a single Ethernet port and that I was using as router for my home network.

Features

  • Complete VLAN support
  • Auto MDIX on all ports
  • Programmable port rate limiting
  • Integrated MIB counters
  • TTL UART interface for external access of switch configuration


Read more of this post

Hello, WordPress!

Hello, WordPress!

My name is Fabio, I’m a Free Software enthusiast with an orientation for lowlevel software and firmware programming and some bit of hardware design.

I write on these pages to give something back to the community, and I plan to post on many subjects of my interests, which include GNU/Linux systems, networking, microcontrollers, automation, electronic design and complete projects I make in my spare time.

Learn more about me on the about me page.

Enjoy!