L
L
lite1232014-09-30 11:30:10
Hetzner
lite123, 2014-09-30 11:30:10

How to add an additional IP to the server?

Hey! I ordered an additional IP for a virtual machine on the server (hetzner), received all the necessary data:
IP
Gateway
Mask

Tell me how to add them to Linux Ubuntu 14.04 so that you can specify a connection with this IP.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2014-09-30
@lite123

ip addr add ${ip_a}/${netmask} dev ${interface}
where ${ip_a} is your ip-address
${netmask} is your mask
${interface} is the interface to add ip to.
If the gateway address differs from the default gateway, it will probably be necessary to add more routing rules, like this:

ip ru add from ${ip_a} lookup ${table}
ip ro add default via ${ip_gw} dev ${interface}  table ${table}

where ${ip_gw} is the gateway address for the new ip
${table} is an arbitrary table number, for example 100.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question