# Dedicated server IP configuration

Category: [Dedicated servers / VPS](https://www.cloudvip.com/en/faq/dedicated-servers-vps.md)
Source page: [https://www.cloudvip.com/en/faq/dedicated-servers-vps/dedicated-server-ip-configuration](https://www.cloudvip.com/en/faq/dedicated-servers-vps/dedicated-server-ip-configuration)
Keywords: debian, ip, ipconfig

For network security reasons, all servers are configured with a /32 network (network mask 255.255.255.255) and can therefore only directly reach your gateway and locally configured IP addresses. To be able to "talk" to other servers in the network segment, all other packets must be routed through the gateway.

Debian, Ubuntu

 
For Debian and Ubuntu, network configuration is done in /etc/network/interfaces.

Copy the following code in /etc/network/interfaces and replace  with your IP address.

If you only have 1 IP (/32) you must use a point-to-point configuration. Example:

allow-hotplug enp2s0

iface enp2s0 inet static

address

netmask 255.255.255.255

gateway 100.64.200.1

pointopoint 100.64.200.1

If you took a larger prefix, for example a /29:

allow-hotplug enp2s0

iface enp2s0 inet static

address

netmask 255.255.255.248

gateway

Then restart the network with
/etc/init.d/networking restart
.

To configure multiple IP addresses, follow the steps described above, except that for each additional IP, you specify an alias to enp2s0 in the form enp2s0:x. For the second IP, for example enp2s0:1, the third IP enp2s0:2 and so on.

 
Red Hat, CentOS Stream, Fedora

CentOS network configuration is done in
/etc/sysconfig/network-scripts/ifcfg-eth0
.

 
Edit the file for static IP configuration as follows and replace  with your IP address.

DEVICE=eth0
 BOOTPROTO=static
 NM_CONTROLLED="yes"
 ONBOOT=yes
 IPADDR=
 NETMASK=255.255.255.255 

You must now configure the necessary routes. To do this, create a configuration file /etc/sysconfig/network-scripts/route-eth0 with the following content:

ADDRESS0=100.64.200.1
 NETMASK0=255.255.255.255
 ADDRESS1=0.0.0.0
 NETMASK1=0.0.0.0
 GATEWAY1=100.64.200.1

Restart the network with /sbin/service network restart.

To configure multiple IP addresses, proceed as described above, with the difference that for each additional IP, an alias interface of the form eth0:x must be configured. For the second IP for example /etc/sysconfig/network-scripts/ifcfg-eth0:1, the third IP /etc/sysconfig/network-scripts/ifcfg-eth0:2 etc.

FreeBSD

Please adapt your /etc/rc.conf file in this way :

ifconfig_em0="inet votre-ip netmask 255.255.255.255"
defaultrouter="ip-de-la-gateway"
static_routes="defgw"
route_defgw="-host ip-de-la-gateway -iface em0"

OpenBSD

Please adapt your /etc/hostname.vio0 file like this:

inet votre-ip 255.255.255.255
!route add -inet ip-de-la-gateway/32 -link -iface vio0

Your /etc/mygate file must also contain the gateway IP.
