Skip to content

Commit dd26568

Browse files
committed
New post, from source to Internet
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent f0ae22c commit dd26568

2 files changed

Lines changed: 277 additions & 0 deletions

File tree

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
---
2+
title: Building Infix from Source
3+
description: From git clone to pinging the internet with make run
4+
author: troglobit
5+
date: 2026-05-28 06:00:00 +0100
6+
categories: [howto]
7+
tags: [beginner, buildroot, qemu]
8+
---
9+
10+
There are two ways to take Infix for a spin on your own PC. You can
11+
grab a pre-built release and boot it straight away; that is what the
12+
[Getting Started][gs] and [Infix in GNS3][gns3] posts cover. Or you
13+
can build it yourself from source and boot the result with a single
14+
`make run`. This post is the second path.
15+
16+
Building from source is the way to go when you want to change an Open
17+
Source component, follow the bleeding edge on `main`, hack on Infix
18+
itself, or simply understand how the image is put together. It takes a
19+
bit longer to get going the first time, but everything after that is a
20+
quick edit-build-run loop.
21+
22+
You will need an **x86_64 Linux PC** with around 30 GiB of free disk
23+
space. We recommend [Debian][] based systems like [Ubuntu][] and [Linux
24+
Mint][].
25+
26+
### Install the Build Tools
27+
28+
Buildroot, which Infix is built on, needs a handful of host tools to
29+
bootstrap itself. Most are already present on a typical desktop install;
30+
the rest can be pulled in like this on Debian/Ubuntu based systems:
31+
32+
```bash
33+
$ sudo apt install bc binutils build-essential bzip2 cpio \
34+
diffutils file findutils git gzip \
35+
libncurses-dev libssl-dev perl patch \
36+
python3 rsync sed tar unzip wget mtools \
37+
autopoint bison flex autoconf automake
38+
```
39+
40+
For the current list of requirements, see the [Developer's Guide][dev].
41+
42+
### Get the Source
43+
44+
Clone the Infix tree and pull in its submodules — Buildroot itself is a
45+
submodule, so this step is not optional:
46+
47+
```bash
48+
$ mkdir -p ~/Projects && cd ~/Projects
49+
$ git clone https://github.com/kernelkit/infix.git
50+
...
51+
$ cd infix/
52+
$ git submodule update --init
53+
...
54+
```
55+
56+
### Configure and Build
57+
58+
Select the target you want to build for, then kick off the build. We
59+
use the `x86_64` target since it runs with acceleration in Qemu:
60+
61+
```bash
62+
$ make x86_64_defconfig
63+
$ make
64+
...
65+
```
66+
67+
The first build downloads all the sources and compiles the entire
68+
system, so it may take the better part of an hour on a typical laptop —
69+
now is a good time for a coffee ☕.
70+
71+
> Curious what else is available? `make list-defconfigs` shows every
72+
> supported target, and `make help` lists the most useful make targets.
73+
{: .prompt-tip }
74+
75+
### First Boot with `make run`
76+
77+
When the build finishes you have a bootable image. Launch it in Qemu
78+
with:
79+
80+
```bash
81+
$ make run
82+
...
83+
```
84+
85+
Infix boots in the same terminal. When the login prompt appears, log in
86+
with the default credentials, user/pass: `admin` / `admin`. You land in
87+
a plain shell — this is intentional, it is meant for scripting and
88+
advanced debugging:
89+
90+
```
91+
Run the command 'cli' for interactive OAM
92+
93+
admin@infix-c0-ff-ee:~$
94+
```
95+
96+
Type `cli` to enter the Infix command line interface:
97+
98+
```
99+
admin@infix-c0-ff-ee:~$ cli
100+
101+
See the 'help' command for an introduction to the system
102+
103+
admin@infix-c0-ff-ee:/>
104+
```
105+
106+
To shut the VM down again, you can `poweroff` from inside Infix, or use
107+
the Qemu escape from the terminal: press **Ctrl-a** then **x**.
108+
109+
### Look Around
110+
111+
You are now in the *admin-exec* context. Tap `?` or `Tab` on an empty
112+
line to see what is available, and use `show` to inspect the system:
113+
114+
```
115+
admin@infix-c0-ff-ee:/> show interface
116+
...
117+
admin@infix-c0-ff-ee:/> show ip brief
118+
...
119+
admin@infix-c0-ff-ee:/> show running-config
120+
...
121+
```
122+
123+
To change something, enter the *configure* context with `configure`.
124+
Changes are staged in a scratch copy and only applied when you type
125+
`leave` (or thrown away with `abort`):
126+
127+
```
128+
admin@infix-c0-ff-ee:/> configure
129+
admin@infix-c0-ff-ee:/config/> edit system
130+
admin@infix-c0-ff-ee:/config/system/> set hostname lab-switch
131+
admin@infix-c0-ff-ee:/config/system/> leave
132+
admin@lab-switch:/>
133+
```
134+
135+
For a proper tour of the CLI, see the [CLI Introduction][cli] in the
136+
documentation.
137+
138+
### Get It on the Network
139+
140+
A freshly booted Infix has its ports up but no IP addresses, and the
141+
default user-mode networking sits behind a NAT — fine for a first boot,
142+
but not much fun to interact with: no inbound SSH, no pinging the VM
143+
from the host. Far more interesting is to put it on a bridge, hand it
144+
a DHCP address, and watch it reach the internet.
145+
146+
**1. Set up a bridge on your host.** The easiest way is to install
147+
[virt-manager][], which configures a libvirt NAT network on the bridge
148+
`virbr0` — complete with a DHCP server and a route out to the internet:
149+
150+
```bash
151+
$ sudo apt install virt-manager
152+
```
153+
154+
**2. Switch Infix to bridged networking.** The Qemu wrapper has its own
155+
configuration; open it with:
156+
157+
```bash
158+
$ make run-menuconfig
159+
```
160+
161+
Go to **Networking → Network Mode**, select **Bridged**, and confirm the
162+
**Bridge device** is `virbr0`. Exit and save.
163+
164+
> If `make run` later complains that it is not allowed to use the bridge,
165+
> add a line `allow virbr0` to `/etc/qemu/bridge.conf` (create the file if
166+
> it does not exist) — this permits Qemu's bridge helper to attach to it.
167+
{: .prompt-info }
168+
169+
**3. Boot again** with `make run`. This time the first port, `eth0`, is
170+
wired to `virbr0`.
171+
172+
**4. Enable the DHCP client** on `eth0` from the CLI:
173+
174+
```
175+
admin@lab-switch:/> configure
176+
admin@lab-switch:/config/> edit interface eth0
177+
admin@lab-switch:/config/interface/eth0/> set ipv4 dhcp
178+
admin@lab-switch:/config/interface/eth0/> leave
179+
```
180+
181+
**5. Check the result.** Within a second or two libvirt's DHCP server
182+
hands out a lease (typically on the `192.168.122.0/24` network), which
183+
you can confirm in the CLI with:
184+
185+
```
186+
admin@lab-switch:/> show interface
187+
...
188+
```
189+
190+
**6. Reach the outside.** With an address and a default route in place,
191+
ping a public host:
192+
193+
```
194+
admin@lab-switch:/> ping 1.1.1.1
195+
...
196+
```
197+
198+
That round trip goes from Infix, across `virbr0`, through your host's NAT,
199+
and out to the internet — a virtual switch behaving exactly like the real
200+
thing.
201+
202+
> These changes live in `running-config` and are gone on the next boot.
203+
> To keep them, save with `copy running-config startup-config`. To wipe
204+
> the slate clean instead, `factory-reset` returns the system to defaults.
205+
{: .prompt-info }
206+
207+
### Networking, Brick by Brick
208+
209+
What you just did, in Lego terms, was snap an *IP* brick (with DHCP)
210+
onto the *Ethernet* brick called `eth0`. That is the whole mental
211+
model: in Infix, every networking object is a brick, and a network is
212+
whatever you get by snapping bricks together.
213+
214+
![Linux networking bricks: bridge, ip, vlan, lag, eth, veth, lo](/assets/img/lego.svg)
215+
_**Figure 1:** The networking bricks available in Infix._
216+
217+
There are only a handful of brick types: physical Ethernet (`eth`),
218+
bridges, VLANs, IP, LAG (link aggregation), and `veth` pairs for
219+
containers. They connect in two ways. A lower brick has *one* upper
220+
brick on top of it — a port belongs to *one* bridge. An upper brick
221+
can have *many* lowers — a bridge can swallow several ports.
222+
223+
Those two rules are enough to describe a switch, a router, a
224+
VLAN-tagged uplink, a bonded link, or a container with its own private
225+
interface.
226+
227+
For a tour of every brick and how they fit together, see the
228+
[Network Configuration][net] section of the documentation.
229+
230+
### Handy Make Targets
231+
232+
A few targets you will reach for often once you start hacking:
233+
234+
| Target | What it does |
235+
|------------------------|-----------------------------------------------------|
236+
| `make run` | Boot the built image in Qemu |
237+
| `make run-menuconfig` | Configure the Qemu wrapper (networking, ports, RAM) |
238+
| `make menuconfig` | Configure the Infix image itself (Buildroot) |
239+
| `make list-defconfigs` | List all supported targets |
240+
| `make apply-dev` | Enable `root` login, handy while developing |
241+
| `make foo-rebuild` | Rebuild just package `foo` after changing it |
242+
243+
### Where to Go Next
244+
245+
You now have a full Infix build you can boot, configure, and rebuild at
246+
will. A few directions from here:
247+
248+
- [Getting Started with Infix][gs] — the pre-built release path, if you
249+
want the quick way too
250+
- [Infix in GNS3][gns3] — build multi-node topologies on a graphical
251+
canvas
252+
- [Inside Infix][inside] — how the system is put together, from YANG to
253+
the immutable root filesystem
254+
- [Developer's Guide][dev] and the [full documentation][docs] — the
255+
complete reference, including the [virtual environments][virt] section
256+
257+
Questions and feedback are always welcome in the [Discussion Forum][disc]
258+
and on [Discord][discord]!
259+
260+
[gs]: /posts/getting-started/
261+
[gns3]: /posts/infix-in-gns3/
262+
[inside]: /posts/inside-infix/
263+
[cli]: https://www.kernelkit.org/infix/latest/cli/introduction/
264+
[net]: https://www.kernelkit.org/infix/latest/networking/
265+
[dev]: https://www.kernelkit.org/infix/latest/developers-guide/
266+
[docs]: https://www.kernelkit.org/infix/
267+
[virt]: https://www.kernelkit.org/infix/latest/virtual/
268+
[disc]: https://github.com/orgs/kernelkit/discussions
269+
[discord]: https://discord.gg/6bHJWQNVxN
270+
[virt-manager]: https://virt-manager.org/
271+
[Debian]: https://www.debian.org/
272+
[Ubuntu]: https://ubuntu.com/
273+
[Linux Mint]: https://linuxmint.com/

assets/img/lego.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)