Operating System - HP-UX
1834191 Members
2771 Online
110064 Solutions
New Discussion

Re: HP-UX 11 routing question - please help

 
SOLVED
Go to solution
Darrell Shen
Occasional Advisor

HP-UX 11 routing question - please help

How do I add a route to route all network traffic through a gateway even though the destination ip is in the same subnet of the source ip? For example,
source ip: 10.17.48.2
source subnet: 255.255.252.0
gateway: 10.17.48.1
destination ip: 10.17.48.3

I would like to route all traffic from 10.17.48.2 go through the gateway 10.17.48.1 and reach 10.17.48.3 instead of go directly from 10.17.48.2 to 10.17.48.3.

What routing command should I set on the host 10.17.48.2?
14 REPLIES 14
paolo barila
Valued Contributor

Re: HP-UX 11 routing question - please help

Hi,
I'm sorry but your question is not clear to me:
are source, gateway and destination on different hosts?

Post if possible:
# netstat -rn
# ifconfig lanx #(x=0,1...)

Maybe is not a routing problem but an application one.
share share share
John Waller
Esteemed Contributor

Re: HP-UX 11 routing question - please help

The only way I can think of doing this is to possibly change your subnet mask to 255.255.255.254 on your 10.17.48.2 card.
Darrell Shen
Occasional Advisor

Re: HP-UX 11 routing question - please help

Hi, just to clarify my question:
My purpose is to utilize a load balancing gateway (10.17.48.1). A few hosts (i.e web servers) in the same subnet (10.17.48.x) will have the defaut gateway as 10.17.48.1 that perform the load-balancing function. However, some other hosts (clients) in the same subnet (10.17.48.x) need to reach the load-balanced web server farm by pointing to the gateway 10.17.48.1 with http (tcp80) port. The network packages need to go from the client to the gateway and to one of available web servers and then back from one web server to the gateway and back to the client. If the client is not in the same subnet, it would be ok but if the client is in the same subnet, the reply of web server will go directly to the client instead of going through the gateway then to the the client. Therefore the load-balancing could have a problem. That is the reason why I need a routing solution to let all web servers network traffics go through the gateway absolutely even though the destination ip is in the same subnet.

The above ip are just examples. Here is what I tried on the host server 10.17.50.52 and the load balancing gateway is 10.17.50.40. The client to test is 10.17.50.73. The subnet mask is 255.255.252.0.

I tried the following on 10.17.50.52 --

# route add net 10.17.48.0 netmask 255.255.252.0 10.17.50.40 1
add net 10.17.48.0: gateway 10.17.50.40

-- it came out good, but

# traceroute -i lan0 10.17.50.73
traceroute to 10.17.50.73 (10.17.50.73), 30 hops max, 40 byte packets
1 10.17.50.73 (10.17.50.73) 2.110 ms 0.160 ms 0.153 ms


-- it does not go through the gateway 10.17.50.40

# netstat -rn
Routing tables
Destination Gateway Flags Refs Interface Pmtu
127.0.0.1 127.0.0.1 UH 0 lo0 4136
10.17.50.52 10.17.50.52 UH 0 lan0 4136
10.17.48.0 10.17.50.52 U 2 lan0 1500
10.17.48.0 10.17.50.40 UG 0 lan0 0
127.0.0.0 127.0.0.1 U 0 lo0 0
default 10.17.50.40 UG 0 lan0 0

paolo barila
Valued Contributor

Re: HP-UX 11 routing question - please help

I think you need specific hardware for that architecture or software like:

http://www.linuxvirtualserver.org/architecture.html
share share share
Vincent Fleming
Honored Contributor

Re: HP-UX 11 routing question - please help

I think a host route is what you're looking for:

route add -host 10.17.48.3 10.17.48.1 1

(or something like that... I haven't an HP-UX to look at now).

A -host route is supposed to apply only to the host ip specified, rather than the entire subnet, as is with -net.

Good luck,

Vince
No matter where you go, there you are.
D Block 2
Respected Contributor

Re: HP-UX 11 routing question - please help

Darrell, If my assumption is correct, that .1 and .2 are both routers, then you actually might be doubling your network traffic on this logical network. Might I suggest consulting with a network guru first.. btw, the static routing sounds like a plan, but what happens if you loose one of these routers ? then load balancing is dead.. just some thoughts about the design.. best of luck
Golf is a Good Walk Spoiled, Mark Twain.
RAC_1
Honored Contributor

Re: HP-UX 11 routing question - please help

As Vincentmentioned, host specific route should do it.

route add host dest_host gate_way metric
There is no substitute to HARDWORK
Darrell Shen
Occasional Advisor

Re: HP-UX 11 routing question - please help

Thank you, guys, especially to Vince.
It works with
#route add host 10.17.50.73 10.17.50.40 1

However, I need to specify the local clients each by each. Not so good but it seems it is the only to get it work. In addidtion, could anybody advise how to make all the "route add host ..." available after server reboot. Edit the file etc/rc.config.d/netconf directly? If yes, could you give me an example for HP-UX 11i? Thanks.
Muthukumar_5
Honored Contributor

Re: HP-UX 11 routing question - please help

Configure /etc/rc.config.d/netconf file with ROUTE* settings.

Or else you can write a script to add route with route by checking routing table on netstat -rvn.

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: HP-UX 11 routing question - please help

Hello,

You can edit /etc/rc.config.d/netconf to add these entries and try restarting the network. That should help. You can use "sam" as well to modify network parameters.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: HP-UX 11 routing question - please help

route add host 10.17.50.73 10.17.50.40 1

script for this:

#!/bin/sh

netstat -rn | grep -qE '10.17.50.73'
if [[ ${?} -eq 0 ]]
then
route add host 10.17.50.73 10.17.50.40 1
fi

IT will check table and put the contents.

However netconf file is default way of doing.

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: HP-UX 11 routing question - please help

Hi,

One more information, If you modify in netconf file, it is persistent and stand with reboot.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Darrell Shen
Occasional Advisor

Re: HP-UX 11 routing question - please help

I tried sam but it does not allow me to add any route except the default route. I may not need the script to do route add but I do need to make the added route permanently.
How to edit the file /etc/rc.config.d/netconf correctly for this perpose? Please give me an example. Thanks. The current contents of the file looks like the following --

HOSTNAME="bbwm0052"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
DHCP_ENABLE[0]=0
INTERFACE_MODULES[0]=""
GATED=0
GATED_ARGS=""
RDPD=0
RARP=0
DEFAULT_INTERFACE_MODULES=""
IP_ADDRESS[0]=10.17.50.52
SUBNET_MASK[0]=255.255.252.0
INTERFACE_NAME[0]=lan0
BROADCAST_ADDRESS[0]=10.17.51.255
INTERFACE_STATE[0]=up
ROUTE_DESTINATION[0]=default
ROUTE_GATEWAY[0]=10.17.50.40
ROUTE_COUNT[0]=1
D Block 2
Respected Contributor
Solution

Re: HP-UX 11 routing question - please help

#route add host 10.17.50.73 10.17.50.40 1

save old netconf outside of the current directory: /etc/rc.config.d, and copy to /tmp.

edit netconf from /etc/rc.config.d, and add [1] index below.

ROUTE_DESTINATION[1]=10.17.50.73
ROUTE_GATEWAY[1]=10.17.50.40
ROUTE_MASK[1]=""
ROUTE_COUNT[1]=1
Golf is a Good Walk Spoiled, Mark Twain.