是否可以在 yocto 开发的 Linux 映像中设置静态 IP 地址?
我正在使用 yocto 开发自定义 Linux 映像,我想为所有映像设置一个 IP 地址。有可能吗?我该怎么做?
提前致谢。
I am using yocto to develop custom linux images and I want to set an ip address for all of my images. It is possible? How can I do this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在构建的映像中自动设置静态 IP,请使用
systemd-networkd
:在自定义层中:
对于
,您必须设置要配置的接口systemd-networkd
,例如eth0
、wlan0
、...另外,编辑
${MY_INTERFACE}
到相同的
。详细信息:
.link
,有关详细信息,请查看此 链接示例:
.network
设置网络配置,了解更多信息检查此链接对于静态IP地址,这里有一个例如:
注意
不要忘记根据您想要的界面在所有位置(recipe、.link、.network 文件)编辑
。To automatically set a static IP in the built image, using
systemd-networkd
:In your custom layer:
For
<iface>
you have to set the interface to be configured bysystemd-networkd
, for exampleeth0
,wlan0
, ...Also, edit
${MY_INTERFACE}
to same<iface>
.Details:
<iface>.link
is used if you want to set the network device configuration, for example a custom MAC address, for more info check this linkExample:
<iface>.network
used to set the network configuration, for more info check this linkFor a static IP address, here is an example:
NOTE
Do not forget to edit
<iface>
in all places (recipe, .link, .network files) according to your desired interface.