Ubuntu 配置静态IP和动态IP
sudo vim /etc/network/interfaces
静态IP:
auto lo
iface lo inet loopback
auto ens33
iface ens33 inet static ##打开static
#inface ens33 inet dhcp ##注释dhcp
address 192.168.1.141
netmask 255.255.255.0
gateway 192.168.1.1
动态IP:
auto lo
iface lo inet loopback
auto ens33
#iface ens33 inet static ##注释static
inface ens33 inet dhcp ##打开dhcp
address 192.168.1.141
netmask 255.255.255.0
gateway 192.168.1.1
保存退出
重启网卡
sudo ifdown ens33
sudo ifup ens33
本文详细介绍如何在Ubuntu系统中配置静态IP和动态IP。通过编辑/etc/network/interfaces文件,您可以轻松设置所需的网络参数,包括地址、子网掩码和网关等。文章提供了具体的配置示例,并指导如何重启网卡使更改生效。
3760

被折叠的 条评论
为什么被折叠?



