2

i got a new IP for my server from my host. the server is already hosting one site.

i got a range of IP. like 23.23.23.23~23.23.23.27

how can i add these ?

3 Answers 3

3

You update your /etc/network/interfaces file. Something like this is probably close to what you want.

auto eth0
iface eth0 inet static
    address 23.23.23.23
    netmask 255.255.255.192
    gateway 23.23.23.1
    dns-nameservers 192.168.1.1 192.168.1.2
    dns-search example.com
    # add secondary ip address
    up ip addr add 23.23.23.27/26 brd + dev eth0
    down ip addr del 23.23.23.27/26 brd + dev eth0
2

Beneath your regular iface lines for your default interface, add:

up ip addr add 23.23.23.23/32 dev eth0
up ip addr add 23.23.23.24/32 dev eth0
up ip addr add 23.23.23.25/32 dev eth0
up ip addr add 23.23.23.26/32 dev eth0
up ip addr add 23.23.23.27/32 dev eth0

This will add each IP individually.

Alternatively you can add the network via CIDR in one line:

up ip addr add 23.23.23.24/29 dev eth0

Both will work if the network was added as a proper CIDR network.

0

You could create some ethernet aliases, like this:


ifconfig eth0:1 192.168.0.1/24
ifconfig eth0:2 192.168.0.2/24
ifconfig eth0:3 192.168.0.3/24
ifconfig eth0:4 192.168.0.4/24

You must log in to answer this question.