Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Nov 2010
ip addr command drops ipv4 address after a few minutes
I am learning the ip command and can assign a Class C address using this command:
ip addr add dev eth0 local 192.168.3.229/24
Is this the best way to assign an ip address using the ip command? I understand ifconfig works but I am learning the ip command and want to create a permanent ip4v address.
If you want to permenatly change the config then you want to edit the interface file.
- Join Date
- Jan 2014
I think the previous post must be used to a Debian derivative. Red Hat/Centos doesn't have an /etc/network directory that I know of.
The place to put the file to make this permanent is /etc/sysconfig/network-scripts/ifcfg-eth0. Run system-config-network if you don't know what should go in it. Either use "/etc/init.d/network restart" or "ifup eth0" to start it once that file is built.
However, that's only half the problem. Setting the IP address with ip should last until the next reboot, and if I read between the lines correctly, it's going away before that. I don't know of anything in stock Centos that would reset an Ethernet card. Someone may have set up a security script which goes out and "fixes" things like an Ethernet card that it doesn't know about having an IP address. Setting the card's address via the ifcfg-eth0 file would probably fix that.
Hope this helps
Stuff doesn't just "get lost". Something is