Operating System - HP-UX
1829631 Members
1576 Online
109992 Solutions
New Discussion

Re: How to config default route to use LAN1 instead of LAN0?

 
FTSE SysAdmin
Frequent Advisor

How to config default route to use LAN1 instead of LAN0?

Hi,

We have this system with the following card setups:

100Mb card (lan0) 172.16.2.2
1Gb card (lan1) 172.16.2.1

The gtw for this subnet is 172.16.2.254

Now I noticed that netconf always configure the system and assign the default route to use lan0.

Note: currently on each reboot we have manually to do the following to fix this the default route, to go through lan1 and not through lan0.

route delete default 172.16.2.254
ifconfig lan0 down
route add default 172.16.2.254
ifconfig lan0 up

Would you know a way to have the default route to using lan1 instead of lan0 in the netconf? Many thanks
Miguel Ribeiro
9 REPLIES 9
Jeff Schussele
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

Hi,

That's because 2 IPs in the same subnet is an unsupported config. For the exact reason you're seeing. You cannot guarantee just *which* NIC the traffic will go out.
I'm afraid there's not much you can do about this - other than *not* having 2 NICs in the same subnet.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Muthukumar_5
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

hai,

If you want to default setting to make lan0 to lan1 then,

change the /etc/rc.config.d/netconf file's
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="xx.xx.xx.xxx"
ROUTE_COUNT[0]="0"
ROUTE_ARGS[0]=""

settings.

change the ip there on gateway.

Olympian explained the problems out there.

HTH.
+muthu+
Easy to suggest when don't know about the problem!
Jeff Schussele
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

Hi,

muthu's solution may or may *not* work. There are a lot of switches out there that just do not like traffic coming back to them from a different MAC than they sent it to.
You just have to accept the fact that you're out there in uncharted, unsupported waters & live with the consequences. You really should rethink the whole architecture. IF you need two IPs then just use one NIC & virtual IPs - i.e. lan0 & lan0:1. IF you need the bandwidth then look at HP's APA (Auto POrt Aggregration) SW to get it.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff_Traigle
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

Aside from the problems Jeff mentioned about your specific configuration of both interfaces being on the same subnet... the general solution to what you're asking does reside in your netconf setup. I wanted to clarify what muthu was trying to state about the netconf file change required, however.

The interface configurations in this file are set up as arrays. Ignite and SAM aren't too smart about how they set the default gateway, always making lan0 the interface that gets assigned the default route.

Take the following example of how these are configured by Ignite-UX if you configure two interfaces and the route in it's interface regardless which interface you specify that you want to be the primary:

INTERFACE_NAME[0]="lan0"
IP_ADDRESS[0]="192.168.5.11"
SUBNET_MASK[0]="255.255.255.0"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="192.168.0.1"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

INTERFACE_NAME[1]="lan1"
IP_ADDRESS[1]="192.168.0.16"
SUBNET_MASK[1]="255.255.255.0"
DHCP_ENABLE[1]=0

To correct this, simply change the array index of the ROUTE variables to the one used for the interface you want to use instead. In this case the change would look like this:

INTERFACE_NAME[0]="lan0"
IP_ADDRESS[0]="192.168.5.11"
SUBNET_MASK[0]="255.255.255.0"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

ROUTE_DESTINATION[1]="default"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="192.168.0.1"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

INTERFACE_NAME[1]="lan1"
IP_ADDRESS[1]="192.168.0.16"
SUBNET_MASK[1]="255.255.255.0"
DHCP_ENABLE[1]=0

There are few different scripts that are run at startup to set up the interfaces so it's usually easier to reboot the system to be sure the routing table gets reconfigured with the new setting properly.
--
Jeff Traigle
Jeff Schussele
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

OK - I swear this is my final post on this thread. THINK about this. IF you're going to force ALL outbound traffic - which is what you'll be doing by forcing the default route out that NIC, then why in the hell do you need 2 NICs in that subnet? When you do this, I guarantee you that you'll force all inbound traffic to the same NIC. Switches *always" send inbound to the same MAC the outbound came from. Network devices don't deal in IPs - they *only* deal in MACs.

My (last) 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
FTSE SysAdmin
Frequent Advisor

Re: How to config default route to use LAN1 instead of LAN0?

This is the current netconf configuration for default route.

INTERFACE_NAME[0]=lan1
IP_ADDRESS[0]=172.16.2.1
SUBNET_MASK[0]=255.255.255.0
BROADCAST_ADDRESS[0]=172.16.2.255
INTERFACE_STATE[0]=up
DHCP_ENABLE[0]=0

INTERFACE_NAME[1]=lan0
IP_ADDRESS[1]=172.16.2.2
SUBNET_MASK[1]=255.255.255.0
BROADCAST_ADDRESS[1]=172.16.2.255
INTERFACE_STATE[1]=up

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=255.255.255.0
ROUTE_GATEWAY[0]=172.16.2.254
ROUTE_COUNT[0]=0
ROUTE_ARGS[0]=""

Before I had this system rerouting incoming traffic through lan0 and going out through lan1 (If Im not wrong or incomining through lan1 and going out through lan0). This before setting a default routing.

The main objective is to use lan1 (1Gb) as production and lan0(100Mb) for adm use like rcps/backups, etc. (I' aware that HP APA provides outbound load balancing but isn't what we want to achieve with this 2 nics.)

I've been "playing" with netconf changing the assignations (the [0] and [1]) but the OS simple ignore them and assign the default route to lan0 always. I've including set lan0 as down to see what would happen and after boot the default route didn't even appear to be set.
Miguel Ribeiro
Jeff_Traigle
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

I agree, Jeff. Just wanted to give the mechanics of the general question in the subject.

If I were in his shoes, I would simply disable lan0 and configure lan1 as the only active interface in the first place. If they really need access to both addresses for the system for some reason, your mention of the configuring virtual IPs on the desired interface is definitely the way to go. In this case, the netconf entries would look like this:

INTERFACE_NAME[0]="lan1"
IP_ADDRESS[0]="172.16.2.1"
SUBNET_MASK[0]="255.255.255.0"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="172.16.2.254"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

INTERFACE_NAME[1]="lan1:1"
IP_ADDRESS[1]="172.16.2.2"
SUBNET_MASK[1]="255.255.255.0"
DHCP_ENABLE[1]=0

(SAM might handle this configuration better than it does for the different subnet case. I typically avoid using it, however, so am not sure.)

Your subnet mask may vary.
--
Jeff Traigle
FTSE SysAdmin
Frequent Advisor

Re: How to config default route to use LAN1 instead of LAN0?

Jeff

I agree with you forcing all trafic to go through one card automatically is like as disabling the 2nd one.

But, lets forget for now the card 100Mb(Lan0) and the objectives set for it.

Now that all inbound/outbound goes through lan1, since the default route is set to lan1...

So doing a telnet to lan0 will fail because will not get reply packet though lan0 since will lost.

Its also true that if a default route is set for one card (example lan1) then lan0 is doing nothing then could be considered down all the time even during the boot.

But a problem remains. The system boots, and lan0 is identified as down the default route will not be set. On other hand if the Lan0 is set as up then the default route will be set to use Lan0.

My issue here is: I'd like to find a way to get the default route be set to use lan1 only . And not to go by system defaults (since that is one known factor configured somewere in unknown location)
Miguel Ribeiro
Ron Kinner
Honored Contributor

Re: How to config default route to use LAN1 instead of LAN0?

Playing with the netconf bracket numbers will not work. They are only used to associate groups of commands together and the bracket number for lan0 is not related to the bracket number for your default routes.

Since you know that the following works:

route delete default 172.16.2.254
ifconfig lan0 down
route add default 172.16.2.254
ifconfig lan0 up

why not just put a little script together and make it executable and let it run at boot after the NICs come up?

Ron