要在Linux中设置固定IP地址,可以按照以下步骤进行操作:
sudo vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
sudo /etc/init.d/networking restart
ifconfig
ip addr
请注意,上述步骤适用于使用Debian或Ubuntu等基于Debian的Linux发行版。对于其他发行版(如CentOS或Fedora),网络配置文件和重启网络服务的命令可能会有所不同。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:ubuntu固定ip地址如何设置