Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


[Solved] How to assign 5 new IPs?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[Solved] How to assign 5 new IPs?

JRTechJRTech Member
edited March 2018 in Help

Hello

I have a Dedicated Server from Nocix. I installed Ubuntu 16.04

I have 5 IPs from them.

Let's say

1.2.3.18
1.2.3.19
1.2.3.20
1.2.3.21
1.2.3.22

(The 1.2.3 is not actual number)

Here is my /etc/network/interfaces

auto lo
iface lo inet loopback
auto ens9
iface ens9 inet static
    address 1.2.3.18
    netmask 255.255.255.248
    gateway 1.2.3.17

auto ens9:0
    iface ens9:0 inet static
    address 1.2.3.19
    netmask 255.255.255.248

auto ens9:1
    iface ens9:1 inet static
    address 1.2.3.20
    netmask 255.255.255.248

auto ens9:2
    iface ens9:2 inet static
    address 1.2.3.21
    netmask 255.255.255.248

auto ens9:3
    iface ens9:3 inet static
    address 1.2.3.22
    netmask 255.255.255.248

I can successfully PING those IPs

I then ordered 5 new IPs, they give me this

4.5.6.208/29

(The 4.5.6 is not actual number)

I don't understand it, maybe the new 5 IPs are

4.5.6.208
4.5.6.209
4.5.6.210
4.5.6.211
4.5.6.212

They said 4.5.6.209 as gateway


My question: How can I add those new IPs to /etc/network/interfaces ?

I tried to configure like this but it was failed.

auto lo
iface lo inet loopback
auto ens9
iface ens9 inet static
    address 1.2.3.18
    netmask 255.255.255.248
    gateway 1.2.3.17

auto ens9:0
    iface ens9:0 inet static
    address 1.2.3.19
    netmask 255.255.255.248

auto ens9:1
    iface ens9:1 inet static
    address 1.2.3.20
    netmask 255.255.255.248

auto ens9:2
    iface ens9:2 inet static
    address 1.2.3.21
    netmask 255.255.255.248

auto ens9:3
    iface ens9:3 inet static
    address 1.2.3.22
    netmask 255.255.255.248

auto ens9:4
    iface ens9:4 inet static
    address 4.5.6.208
    netmask 255.255.255.248

auto ens9:5
    iface ens9:5 inet static
    address 4.5.6.209
    netmask 255.255.255.248

auto ens9:6
    iface ens9:6 inet static
    address 4.5.6.210
    netmask 255.255.255.248

auto ens9:7
    iface ens9:7 inet static
    address 4.5.6.211
    netmask 255.255.255.248

auto ens9:8
    iface ens9:8 inet static
    address 4.5.6.212
    netmask 255.255.255.248

Could someone please help me?

Regards

Comments

  • you need to subnet those ip range to get the actualusable ips

  • Hello @livservers
    What does "to subnet those ip range" mean?
    Do you have any guide / links that I can read?

  • CrossBoxCrossBox Member, Patron Provider
    edited March 2018

    Why don't you try for example:

    nano /etc/sysconfig/network-scripts/ifcfg-eth0-range0

    IPADDR_START=4.5.6.208
    IPADDR_END=4.5.6.212
    CLONENUM_START=1
    NETMASK=255.255.255.0
    GATEWAY=(ask them what your gateway is because the one you posted may be incorrect)
    
  • NomadNomad Member

    Make it like below and you're golden.
    PS: You can change the label part as you see fit.

     auto ens9
     iface ens9 inet static
     address 1.2.3.18
     netmask 255.255.255.248
     gateway 1.2.3.17.
     dns-nameservers 9.9.9.9 8.8.8.8
    
    
     up /sbin/ip addr add 4.5.6.208 dev ens9 label ens9:100
     up /sbin/ip addr add 4.5.6.209 dev ens9 label ens9:101
     up /sbin/ip addr add 4.5.6.210 dev ens9 label ens9:102
     up /sbin/ip addr add 4.5.6.211 dev ens9 label ens9:103
     up /sbin/ip addr add 4.5.6.212 dev ens9 label ens9:104
    
     down /sbin/ip addr del 4.5.6.208 dev ens9 label ens9:100
     down /sbin/ip addr del 4.5.6.209 dev ens9 label ens9:101
     down /sbin/ip addr del 4.5.6.210 dev ens9 label ens9:102
     down /sbin/ip addr del 4.5.6.211 dev ens9 label ens9:103
     down /sbin/ip addr del 4.5.6.212 dev ens9 label ens9:104
    
  • @CrossBox It looks like that code is for RPM based, I am using Ubuntu 16.04 .

    According to staff, 4.5.6.208 is the gateway for 5 new IPs

    I try @Nomad's suggestion for single IP. But after rebooting the server it's still failed

  • I would recommend asking the staff:

    1) What are the subnet masks for the IPs?
    2) What is the gateway address?
    3) Would it be possible to use 1.2.3.17 as the gateway?

    If #3 is not possible, then you will need to employ policy routing (which is not difficult).

  • niknik Member, Host Rep
    edited March 2018

    From the info you gave us you got a /29 prefix. 209 is the gateway, so starting from .210 it's useable for you:

    4.5.6.210
    4.5.6.211
    4.5.6.212
    4.5.6.213
    4.5.6.214

    These 5 IPs should be added to the interfaces file.

    You don't need to reboot the whole server, you can just use ifup and ifdown to bring an interface up and down.

    Thanked by 2JRTech CrossBox
  • Why not just get /28 instead?

  • Thank you @nik. It works now,

    I didn't think the IPs start from 210-214 I thought it starts from 208-213 as the information I've got on Nocix panel (See IPv4 Assignment #2)

    This is my current settings and it works well.

    auto lo
    iface lo inet loopback
    auto ens9
    iface ens9 inet static
        address 1.2.3.18
        netmask 255.255.255.248
        gateway 1.2.3.17
    
    auto ens9:0
        iface ens9:0 inet static
        address 1.2.3.19
        netmask 255.255.255.248
    
    auto ens9:1
        iface ens9:1 inet static
        address 1.2.3.20
        netmask 255.255.255.248
    
    auto ens9:2
        iface ens9:2 inet static
        address 1.2.3.21
        netmask 255.255.255.248
    
    auto ens9:3
        iface ens9:3 inet static
        address 1.2.3.22
        netmask 255.255.255.248
    
    auto ens9:4
        iface ens9:4 inet static
        address 4.5.6.210
        netmask 255.255.255.248
    
    auto ens9:5
        iface ens9:5 inet static
        address 4.5.6.211
        netmask 255.255.255.248
    
    auto ens9:6
        iface ens9:6 inet static
        address 4.5.6.212
        netmask 255.255.255.248
    
    auto ens9:7
        iface ens9:7 inet static
        address 4.5.6.213
        netmask 255.255.255.248
    
    auto ens9:8
        iface ens9:8 inet static
        address 4.5.6.214
        netmask 255.255.255.248
    

    The problem is solved.

Sign In or Register to comment.