R
R
RoffDaniel2021-02-13 21:07:25
CentOS
RoffDaniel, 2021-02-13 21:07:25

How to add IP address to iproute2 table from IP block?

Good afternoon. Can you please tell me why I cannot add an IP address to the iproute2 table from the IP block?

There is a block of four IP addresses: xxx.xxx.xxx.60-xxx.xxx.xxx.63. I enter the first four addresses in the table without problems:


ip route add xxx.xxx.xxx.60 dev ens20 scope link src xxx.xxx.xxx.60 table wan-60
ip route add xxx.xxx.xxx.61 dev ens21 scope link src xxx.xxx.xxx.61 table wan -61
ip route add xxx.xxx.xxx.62 dev ens22 scope link src xxx.xxx.xxx.62 table wan-62
Here's the last one, I get:
ip route add xxx.xxx.xxx.63 dev ens23 scope link src xxx.xxx.xxx.63 table wan-63
Error: Invalid prefsrc address.


I so guess that the last is ala the gateway. But, the mask for this block is /30 (255.255.255.252). That is, in fact, the gateway is xxx.xxx.xxx.252. I just can't get the logic. Please advise
60281547498df373054563.png
6028154df3077340879803.png

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2021-02-13
@RoffDaniel

Judging by your phrase "That is, in fact, the gateway is xxx.xxx.xxx.252" you do not understand what a subnet mask is.
You have a subnet of 4 addresses (just the same mask 255.255.255.252), of which two are available to you - the second and third.
The first address is the network ID.
The last address on the subnet is the reserved address for broadcasts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question