@@ -107,9 +107,6 @@ sudo iptables-nft -A FORWARD -i tap0 -o eth0 -j ACCEPT
107
107
108
108
## Setting Up Firecracker
109
109
110
- Before starting the guest, configure the network interface using Firecracker's
111
- API:
112
-
113
110
** Note:** If you use the rootfs from the
114
111
[ getting started guide] ( getting-started.md ) , you need to use a specific ` MAC `
115
112
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
118
115
configuration. This way, the guest will generate a random MAC address on
119
116
startup.
120
117
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
+
121
132
``` bash
122
133
curl --unix-socket /tmp/firecracker.socket -i \
123
- -X PUT ' http://localhost/network-interfaces/eth0 ' \
134
+ -X PUT ' http://localhost/network-interfaces/my_network0 ' \
124
135
-H ' Accept: application/json' \
125
136
-H ' Content-Type: application/json' \
126
137
-d ' {
127
- "iface_id": "eth0 ",
138
+ "iface_id": "my_network0 ",
128
139
"guest_mac": "06:00:AC:10:00:02",
129
140
"host_dev_name": "tap0"
130
141
}'
@@ -136,7 +147,7 @@ configuration file like this:
136
147
``` json
137
148
"network-interfaces" : [
138
149
{
139
- "iface_id" : " eth0 " ,
150
+ "iface_id" : " my_network0 " ,
140
151
"guest_mac" : " 06:00:AC:10:00:02" ,
141
152
"host_dev_name" : " tap0"
142
153
}
@@ -148,9 +159,6 @@ Alternatively, if you are using firectl, add
148
159
149
160
## In The Guest
150
161
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
-
154
162
You'll now need to assign the guest its IP, activate the guest's networking
155
163
interface and set up the ` tap ` IP as the guest's gateway address, so that
156
164
packets are routed through the ` tap ` device, where they are then picked up by
0 commit comments