ubuntu 设置静态ip,但显示scope global secondary ens33


设置静态ip

修改 /etc/network/interfaces 文件

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet static
address 192.168.1.112
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet static
address 192.168.1.112
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8

重启网络

systemctl restart networking.service

问题:ip ad s 查看网络以前的旧ip还存在,新的ip虽然可以使用但会出现丢失的情况

 

解决:

ip addr flush dev ens33

ifdown ens33
ifup ens33

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM