Operating System - Linux
1827293 Members
2359 Online
109717 Solutions
New Discussion

Re: IP Aliasing with different gateways

 
Qcheck
Super Advisor

IP Aliasing with different gateways

I would like to alias the eth0(eth0: 10.10.10.1 with 255.255.255.0) as follow in:
/etc/rc.local
eth0:1 as 10.157.104.120 with 255.255.255.128
route add default gw 10.157.114.1
eth0:2 as 10.157.68.120 with 255.255.255.0
eth0:3 as 192.168.30.120 with 255.255.255.0

I did the above, however I can't ssh(as gateway isn't set for each subnet I guess as I don't see any gateway from netstat -rn output). But I can ssh through one of the nodes and is working. The reason I want to set like above is for the kickstart setup for different subnet setups. So that I don't need to change each time to switch between the subnets to make kickstart work.

What am I missing? Do I need to add the routing line for each subnet?

Thank you
5 REPLIES 5
Matti_Kurkela
Honored Contributor

Re: IP Aliasing with different gateways

Your route command might have a typo.

Without adding the default route, eth0 allows access to addresses 10.10.10.(0...255) and eth0:1 to 10.157.104.(0...127).

At the point your route command is issued, eth0:2 and eth0:3 are not defined yet.

You then attempt to add 10.157._114_.1 as the default gateway. Because this is not in any of the already-defined directly-accessible segments and there is no default gateway yet, the system does not know how to reach it. As a result, this route is rejected.

Perhaps you meant 10.157._104_.1 as the default gateway?

MK
MK
Qcheck
Super Advisor

Re: IP Aliasing with different gateways

Mk, First of all thank you for your response and I really appreciate. Sorry, I did typo in the forum, instead "route add default gw 10.157.104.1" I typed "route add default gw 10.157.114.1".

Any ideas?
Horia Chirculescu
Honored Contributor

Re: IP Aliasing with different gateways

Hello,

How does your routing table looks like?

(
route -n / netstat -rn
)

The command:

route add default gw 10.157.104.1

gives you any error?

>But I can ssh through one of the nodes and is working.

Which node? from which network/IP address?

Horia.



Best regards from Romania,
Horia.
Qcheck
Super Advisor

Re: IP Aliasing with different gateways

Never mind, it is working. I was testing in /etc/rc.local. I typed the wrong ip address. Once I fixed it, I added eth0:1 and eth0:2 and eth0:3 in the network scripts and it working fine for all the different subnets. And removed all the entries from rc.local. Thank you for your time and response.
Qcheck
Super Advisor

Re: IP Aliasing with different gateways

I fixed it. I was testing in /etc/rc.local. I typed the wrong ip address. Once I fixed it, I added eth0:1 and eth0:2 and eth0:3 in the network scripts and it working fine for all the different subnets. And removed all the entries from rc.local. Thank you for your time and response.