Operating System - HP-UX
1851015 Members
2747 Online
104056 Solutions
New Discussion

2 lan cards, 2 IPs on same subnet how to choose which one to use

 
Jonathan Caplette_1
Super Advisor

2 lan cards, 2 IPs on same subnet how to choose which one to use

hi guys,

I've a box with 2 lan cards (here in my case lan1 and lan3) configured on the same subnet:

# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
lan3 1500 142.101.127.0 142.101.127.38 110752671 0 693951992 0 0
lan1 1500 142.101.127.0 142.101.127.43 1615284800 0 1184988610 0 0
lan0 1500 10.192.41.0 10.192.41.43 1384923343 0 2800573313 0 0
lo0 4136 127.0.0.0 127.0.0.1 24386238 0 24386239 0 0

lan0 is currently my backend, lan1 is the IP configured for the application users , and lan3 (which is the one on the same subnet than lan1) is used for taking backup, as I see in the hosts file.

Well I need to get out by .43 when I do for exemple a traceroute: it says multiple interfaces using lan3... The thing is that the firewall is opened only for traffic comming from .43

# traceroute 208.252.131.100
traceroute: Warning: Multiple interfaces found; using 142.101.127.38 @ lan3
traceroute to 208.252.131.100 (208.252.131.100), 30 hops max, 40 byte packets
1 142.101.127.1 (142.101.127.1) 0.618 ms 0.567 ms 0.543 ms


I don't know if this is possible to have 2 lan cards on the same subnet? If so how can I specify how to use lan1 by default?

Regards
Jonathan
8 REPLIES 8
Avinash20
Honored Contributor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

Refer

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=786336
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Jonathan Caplette_1
Super Advisor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

Sorry i'm missing some infos...

I'm running HP-UX 11.11, and here is the routing table:

# netstat -rn
Routing tables
Destination Gateway Flags Refs Interface Pmtu
127.0.0.1 127.0.0.1 UH 0 lo0 4136
142.101.127.43 142.101.127.43 UH 0 lan1 4136
142.101.127.38 142.101.127.38 UH 0 lan3 4136
10.192.41.43 10.192.41.43 UH 0 lan0 4136
10.192.41.0 10.192.41.43 U 2 lan0 1500
142.101.127.0 142.101.127.43 U 2 lan1 1500
10.254.247.0 10.192.41.1 UG 0 lan0 0
10.11.246.0 10.192.41.1 UG 0 lan0 0
127.0.0.0 127.0.0.1 U 0 lo0 0
default 142.101.127.1 UG 0 lan3 0


I can probably add a route to the specific lan...
Avinash20
Honored Contributor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

Either use traceroute binary from 11.00 or use traceroute -i lan0 -s IPaddress
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Avinash20
Honored Contributor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

$ traceroute remote
traceroute: Warning: Multiple interfaces found; using X.X.X.X @ lan0

The traceroute command now selects the source IP address to place in
the outbound packet based upon the first lan interface it finds in the
system as opposed to using the source IP address of the interface the
packet is routed out of.

On hosts with a single interface, this is not a problem but on hosts
with multiple interfaces, this may cause problems or confusing results.

Specifically, if the IP address used as the source of the outbound
packet is not the IP address of the lan interface that the packet is
sent on the remote node(s) may not be able to respond to the packet.

In such cases, you will need to determine which interface the packets
will be routed out of based upon the routing tables (use "netstat -rn").
Once you have determined the interface you may use the -i option to the
traceroute command to specify thus interface. Traceroute will then take
the IP address off of this interface and use it as the source IP
address.

It should be noted that the -i option as in:

/usr/contrib/bin/traceroute -i lan3

does not force the packet to go OUT lan3 it mearly instructs the
command to use the source IP assigned to lan3.

PS: Assign point
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Jonathan Caplette_1
Super Advisor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

Thanks Avinash for the fast answer... Maybe traceroute was a bad exemple...

What currently need to do is a sftp out to an address, but in the firewall rules to get out of my network i'm only granted to do it from the lan1 IP. And for a reason unknown to me when I do my sftp out I'm hitting my firewall with my lan3 IP.

I tried with the -i option on the traceroute commands and it worked good with traceroute (always good to known)
Jonathan Caplette_1
Super Advisor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

OK I solved my problem by adding a route with a local count on the IP I what to use..

route add host x.x.x.x gateway x.x.x.x 0

now it works...
Jonathan Caplette_1
Super Advisor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

see before this comment
rick jones
Honored Contributor

Re: 2 lan cards, 2 IPs on same subnet how to choose which one to use

With multiple physical (as viewed by the transport) interfaces configured into the same IP subnet, indeed the "solution" is to either add explicit routes, or enable a variation on ip_strong_es_model and make certain the app bind()s to the correct source IP.

Otherwise, the stack assumes that each interface configured in the same subnet has equal connectivity to the rest of the world.

there is no rest for the wicked yet the virtuous have no pillows