When working with BGP networks (private networks in Germany and the Netherlands), you may need to manually assign a private IP address to a server.
Depending on the operating system, you can do this using one of the instructions below.
In the examples, we configure the IP address 192.168.0.12/24. Replace it with the address you need.
Check the current network settings:
ip a
The following output indicates that no private IP address is assigned to the eth1 interface (there is no inet field with a private address):
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 54:52:00:f2:d0:09 brd ff:ff:ff:ff:ff:ff
altname enp0s8
altname ens8
inet6 fe80::5652:ff:fef2:d009/64 scope link
valid_lft forever preferred_lft forever
Open or create a Netplan configuration file:
nano /etc/netplan/99-ipv4.yaml
Add the following configuration:
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: false
addresses:
- "192.168.0.12/24"
Here:
eth1 is the interface name obtained from ip a.192.168.0.12 is the private IP address you want to assign.Restrict permissions on this file so only root can read it:
chmod 600 /etc/netplan/99-ipv4.yaml
Apply the Netplan configuration:
netplan apply
After rebooting, the address may not yet be assigned by the time other services attempt to bind to it. To avoid issues, allow binding to non-local addresses. Open /etc/sysctl.conf:
nano /etc/sysctl.conf
Add the following lines:
net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1
Reload the sysctl configuration:
sysctl -p /etc/sysctl.conf
Restart the networking service:
systemctl restart systemd-networkd
Check the result:
ip a
If the private IP was successfully added, you will see a line with your address, for example:
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 54:52:00:c3:bb:ae brd ff:ff:ff:ff:ff:ff
altname enp0s8
altname ens8
inet 192.168.0.12/24 brd 192.168.0.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::5652:ff:fec3:bbae/64 scope link
valid_lft forever preferred_lft forever
Check the current network settings:
ip a
The following output indicates that no private IP address is assigned to eth1:
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 54:52:00:f2:d0:09 brd ff:ff:ff:ff:ff:ff
altname enp0s8
altname ens8
inet6 fe80::5652:ff:fef2:d009/64 scope link
valid_lft forever preferred_lft forever
Open the network interfaces configuration file:
nano /etc/network/interfaces
Add the following lines:
auto eth1
allow-hotplug eth1
iface eth1 inet static
address 192.168.0.12/24
Here:
eth1 is the interface name obtained from ip a.192.168.0.12 is the private IP you want to assign.Allow binding to the address. Open /etc/sysctl.conf:
nano /etc/sysctl.conf
Add these lines:
net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1
Reload the configuration:
sysctl -p /etc/sysctl.conf
Restart the networking service:
systemctl restart networking.service
Check the result:
ip a
You should now see your assigned IP address:
inet 192.168.0.12/24 brd 192.168.0.255 scope global eth1
Check the current network settings:
ip a
The following output indicates that no private IP is assigned to ens8:
3: ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 54:52:00:43:ee:26 brd ff:ff:ff:ff:ff:ff
altname enp0s8
inet6 fe80::6f23:a5e7:7cb1:d9d9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Add a private IP address to the interface. First, check the connection name:
nmcli connection show
Find the name assigned to ens8 (in this example: Wired connection 1).

Add the private IP to the connection:
nmcli connection modify 'Wired connection 1' ipv4.addresses 192.168.0.12/24
Here, 192.168.0.12 is the private IP you want to assign.
Check that the IP was added:
nmcli connection show 'Wired connection 1' | grep addresses
Disable old configurations. Check the directory:
ls /etc/sysconfig/network-scripts/
If there is a file named ifcfg-ens8, move it elsewhere to disable legacy settings:
mv /etc/sysconfig/network-scripts/ifcfg-ens8 /root/ifcfg-ens8-Backup-$(date +"%Y%m%d")
Ensure the configuration persists after reboot by adding this linet to the 99-disable-network-config.cfg file:
echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Allow binding to the address. Open the config files:
vi /etc/sysctl.conf
Add these lines:
net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1
Reload the configuration:
sysctl -p /etc/sysctl.conf
Restart NetworkManager:
systemctl restart NetworkManager.service
Check the result:
ip a
You should now see your assigned IP:
inet 192.168.0.12/24 scope global ens8