凝思操作系统ip配置文件interfaces与实际IP不符

进入到网卡配置目录

cd /etc/netwrok/
vim interfaces

网卡配置信息

source /etc/network/interfaces.d/*.conf
auto lo
iface lo inet loopback
    allow-hotplug eth0

auto eth2
allow-hotplug eth2
iface eth2 inet static
    address 100.100.100.1
    netmask 255.255.0.0

以上配置文件是一个完整的配置文件。添加IP地址,只需要添加以下的配置信息即可。

auto eth2
allow-hotplug eth2
iface eth2 inet static
    address 100.100.100.1
    netmask 255.255.0.0

添加完IP地址后,重启网卡

sudo service networking restart

以上转载来自: 

凝思Linux操作系统,给网卡添加IP地址_lemmon_tree的博客-CSDN博客_linux凝思系统配置ip地址

 但在实际应用中,发现,该文件中配置了如上的ip地址,开机后发现ip地址与实际的不对应。

原因:

在/etc/rc.local文件中也配置了设置ip的信息,所以主机启动过程中,应该是先运行了interfaces文件,后又运行了rc.local中的shell命令。

for n in `seq 0 4`;
do
  ifconfig eth$n 192.168.$n.222
done
ifconfig eth5 193.100.33.33

猜你喜欢

转载自blog.csdn.net/modi000/article/details/123471511