Ubuntu遇到一个常见的静态IP设置问题,记录如下:
通常设置静态IP大家
Failed to restart networking.service: Unit networking.service not found.
/etc/init.d/networking: command not found
一、参考文档:
1. Systemd: Setup a static IP Address
https://michlstechblog.info/blog/systemd-setup-a-static-ip-address/
二、设置方法:
1. 打开systemd的网络管理功能:
systemctl enable systemd-networkd.service
2. 设置网卡信息:
root@zengjf:/etc/systemd/network# cat 10-static-eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.1.202/24
Gateway=192.168.1.1
DNS=8.8.8.8