Skip to content

Commit 1d7431a

Browse files
ShadowCurseManciukic
authored andcommitted
chore: clarify network naming in network-setup.md
Make it more clear that the `iface_id` is only used internally in Firecracker. Move information about the order of network interface creation and network interface names in the guest from FAQ into network-setup.md. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent f0452e3 commit 1d7431a

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

FAQ.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,6 @@ them according to your needs.
178178
The relatively high FD usage is expected and correct. Firecracker heavily relies
179179
on event file descriptors to drive device emulation.
180180

181-
### How does network interface numbering work?
182-
183-
There is no relation between the numbering of the `/network-interface` API calls
184-
and the number of the network interface in the guest. Rather, it is usually the
185-
order of network interface creation that determines the number in the guest (but
186-
this depends on the distribution).
187-
188-
For example, when you create two network interfaces by calling
189-
`/network-interfaces/1` and then `/network-interfaces/0`, it may result in this
190-
mapping:
191-
192-
```console
193-
/network-interfaces/1 -> eth0
194-
/network-interfaces/0 -> eth1
195-
```
196-
197181
### How can I gracefully reboot the guest? How can I gracefully poweroff the guest?
198182

199183
Firecracker does not virtualize guest power management, therefore operations

docs/network-setup.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ sudo iptables-nft -A FORWARD -i tap0 -o eth0 -j ACCEPT
107107

108108
## Setting Up Firecracker
109109

110-
Before starting the guest, configure the network interface using Firecracker's
111-
API:
112-
113110
**Note:** If you use the rootfs from the
114111
[getting started guide](getting-started.md), you need to use a specific `MAC`
115112
address like `06:00:AC:10:00:02`. In this `MAC` address, the last 4 bytes
@@ -118,13 +115,27 @@ it is `172.16.0.2`. Otherwise, you can skip the `guest_mac` field for network
118115
configuration. This way, the guest will generate a random MAC address on
119116
startup.
120117

118+
**Note:** The `iface_id` used during VM configuration is internal to Firecracker
119+
and only used for management purposes. The name of the network interface in the
120+
guest is determined by the guest itself. In this example we assume the guest
121+
will name the network interface `eth0`.
122+
123+
> [!NOTE]
124+
> Firecracker cannot guarantee that the network interfaces in the guest will be
125+
> initialized in the guest in the same order as API calls used to set them up.
126+
> At the same time most kernels/distributions do initialize devices in the API
127+
> defined order.
128+
129+
Before starting the guest, configure the network interface using Firecracker's
130+
API:
131+
121132
```bash
122133
curl --unix-socket /tmp/firecracker.socket -i \
123-
-X PUT 'http://localhost/network-interfaces/eth0' \
134+
-X PUT 'http://localhost/network-interfaces/my_network0' \
124135
-H 'Accept: application/json' \
125136
-H 'Content-Type: application/json' \
126137
-d '{
127-
"iface_id": "eth0",
138+
"iface_id": "my_network0",
128139
"guest_mac": "06:00:AC:10:00:02",
129140
"host_dev_name": "tap0"
130141
}'
@@ -136,7 +147,7 @@ configuration file like this:
136147
```json
137148
"network-interfaces": [
138149
{
139-
"iface_id": "eth0",
150+
"iface_id": "my_network0",
140151
"guest_mac": "06:00:AC:10:00:02",
141152
"host_dev_name": "tap0"
142153
}
@@ -148,9 +159,6 @@ Alternatively, if you are using firectl, add
148159

149160
## In The Guest
150161

151-
Once you have booted the guest, it will have its networking interface with the
152-
name specified by `iface_id` in the Firecracker configuration.
153-
154162
You'll now need to assign the guest its IP, activate the guest's networking
155163
interface and set up the `tap` IP as the guest's gateway address, so that
156164
packets are routed through the `tap` device, where they are then picked up by

0 commit comments

Comments
 (0)