Manually Configure IP address in CentOS7/RHEL7.
- August 29th, 2018
- Posted in Documentation
- Write comment
Let me just preface this post by saying “This is not a persistent configuration. If you boot the system, these settings will be lost unless you save them via the /etc/sysconfig/network-scripts files or through NetworkManager.
Here is how you can manually configure the IP address and gateway in CentOS/RHEL7:
Configure the IP address and subnet mask:
# ip addr add aaa.bbb.ccc.ddd/ss dev interface
For example:
# ip addr add 123.123.123.123/24 dev eno1
Likewise, to remove the IP address:
# ip addr del 123.123.123.123/24 dev eno1
To configure the default gateway:
# ip route add default via ddd.ccc.bbb.aaa dev interface
For example:
# ip route add default via 123.123.123.254 dev eno1
Same kind of thing to remove the currently configured gateway:
# ip route del default via 123.123.123.254 dev eno1
Once you have the interface configure, bring it up:
# if link set eno1 up
And to take it down:
# if link set eno1 down
No comments yet.