Home  >  Q&A  >  body text

Linux static ip does not take effect

As shown in the figure above, the ip configured in /etc/sysconfig/network-scripts/ifcfg-enp0s3 is static, but after restarting, the ip is not 192.168.1.124. Why is this? My local computer cannot ping 192.168.1.124, which means this IP is not occupied

阿神阿神2692 days ago763

reply all(4)I'll reply

  • PHP中文网

    PHP中文网2017-06-05 11:12:51

    Try changing IPADDRESS to IPADDR?

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-05 11:12:51

    http://jingyan.baidu.com/arti... I configured it as above and there is no problem

    reply
    0
  • 某草草

    某草草2017-06-05 11:12:51

    There is a typo in this line, but it seems to have nothing to do with the problem: ePV6INIT=yes

    I guess your problem lies in the IP, 192.168.1.124/255.255.0.0. This network segment includes the 192.168.122.1/255.255.255.0 network segment of virbr0. In reality, there should be no such subnet division. Judging from the final IP 192.168.31.183/255.255.255.0 on your enp0s3, it should be that Linux failed to apply the static IP you configured first, and then obtained the IP from the DHCP server. If this is the case, then your enp0s3 should be in For the 192.168.31.0/255.255.255.0 network segment, you can try configuring an IP for the 192.168.31.0/255.255.255.0 network segment. If there is no problem, it means that the configuration format is not wrong, but there is a problem with the IP and subnet mask.

    You can also try running ifdown enp0s3 first and then ifup enp0s3 command to restart the network card and see if ifup outputs any prompt information.

    reply
    0
  • 某草草

    某草草2017-06-05 11:12:51

    I found the problem, it turned out that IPADDR was written as IPADDRESS, sweat! ! !

    reply
    0
  • Cancelreply