目录
一、问题描述
终端安装完所有app,重启之后IP地址不存在了
clou@SMIOS:~# ifconfig
FE0 Link encap:Ethernet HWaddr 7A:56:90:5B:2F:4F
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:87 Base address:0xb000
FE1 Link encap:Ethernet HWaddr 36:C9:E3:F1:B8:05
inet6 addr: fe80::34c9:e3ff:fef1:b805/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:109 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8678 (8.4 KiB) TX bytes:1152 (1.1 KiB)
Interrupt:117
二、解决方案
修改以下文件/etc/network/interfaces.d/FE0、/etc/network/interfaces.d/FE1,去掉静态IP设置或者DHCP设置部分:
屏蔽掉:#iface FE0 inet dhcp
clou@SMIOS:~# cat /etc/network/interfaces.d/FE0
#iface FE0 inet manual
auto FE0
#allow-hotplug FE0
#iface FE0 inet dhcp
iface FE0 inet static
address 192.168.2.170
netmask 255.255.252.0
gateway 192.168.2.254
dns-nameservers 192.168.2.240
clou@SMIOS:~# ifconfig
FE0 Link encap:Ethernet HWaddr 7A:56:90:5B:2F:4F
inet addr:192.168.2.170 Bcast:192.168.3.255 Mask:255.255.252.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:87 Base address:0xb000
FE1 Link encap:Ethernet HWaddr 36:C9:E3:F1:B8:05
inet addr:192.168.1.170 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::34c9:e3ff:fef1:b805/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:153 errors:0 dropped:0 overruns:0 frame:0
TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14162 (13.8 KiB) TX bytes:6553 (6.3 KiB)
Interrupt:117
参考:https://blog.csdn.net/weixin_44278403/article/details/107775352