I am really inexperienced with Linux and networking.
I bought an unmanaged dedicated server running ubuntu 16.04. I am having problems with binding the ipv4/24 range with my dedicated server. How would I bind/add my IP range to my dedicated server?
TomTom point has a lot of merit. Do consider seriously educating yourself on network management, or pay someone to do that for you. That being said, I’m all for people working through their problems towards proficiency, and using Server Fault to help with that, and messing with an unmanaged server is a great way to do that – just take into account that you will get into a lot of trouble.
Ubuntu 16.04 is pretty old is will go out of support next year. It is a Long Term Support release, but LTS in Ubuntu means 5 years. It would have been much better to start with a new 20.04 LTS installation, or even an 18.04 (giving you 3 years to figure it out before you have to upgrade). The fact that you got a new server with 16.04 is troubling – I would suggest you consider switching providers.
Make sure your provider is routing IPv4 range your bought to your server – this is out of your control and often where the line breaks. If you think you configured everything correctly and it still doesn’t work – give your provider’s support a call.
To set up the network interface, you’d want to add an entry to
/etc/network/interfacesor create a new file with the entry in
man interfacesfor the full documentation or this article for a simple example.
You start by figure out your interface name – this should be easy by running
ip a and find the correct interface, probably by looking for the other IP addresses that are supposed to already be attached to the correct interface. It should look like
As you are adding an additional IP address in addition to the existing one, you’d need to add an “alias interface” – think of it like a virtual interface card – it is bound to the same hardware but has additional configuration.
Then create the interface alias file (or edit the
interfaces file) like in this example – I’m assuming the interface is named
ens5 and it will take the IP address
192.168.1.1, and it will be the first alias:
iface ens5:1 inet static address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.254
If you want to add more IP addresses to the same interface, you’d need to increment the alias ID – the part after the
: in the interface name – for each new address.