How to add IPs to a CentOS Server?
I wanted to know how to add the Prefix, the usable range & the subnet mask. I'm a completely new to this field so I would need step-by-step instructions. Thanks in advance.
Regards,
Netizen
P.S. I've no control panel installed.
Assuming you want to do it permanently
Create a new file /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
ONBOOT=yes
Then issue ifup eth0:1
If you just want to add an IP temporarily (or without persistence between reboots).
ip addr add 192.168.0.2/24 dev eth0
The /24
represents the netmask 255.255.255.0
in CIDR notation
Google first before asking on SF, your question is exceptionally well covered on the internet.