route table

EN1:10.62.0.9 gateway1:10.62.0.14
EN2:10.62.66.81 gateway2:10.62.66.94

We want to connect en1 to 10.50.23.4 through gateway1 and
connect en2 to 10.50.22.4 through gateway2,below is my config:

route delete 10.0.0.0
route add -net 10.62.0.0 -interface 10.62.0.9
route add -net 10.62.66.0 -interface 10.62.66.81

route add 10.50.23.4 10.62.0.14 //A
route add 10.50.22.4 10.62.66.94 //B

but it’s very strange that only one channel can be created,for example if i
set as above i can ping to 10.50.23.4,but i can’t ping to 10.50.22.4,if i exchange A and B,i can ping to 10.50.22.4,but i can’t ping to 10.50.23.4,i don’t know the reason,please help me,thanks.

I’m a little unsure of whether this is the problem, but the leading bit of your first byte (10) is 0. According to en.wikipedia.org/wiki/Classful_network, this means you are using a Class A network. While you should be able to subnet this, I’m not sure if you are doing it properly. Maybe if you use the “MASK” argument with route, specifying the subnet mask it will work better?

we use the same subnet mask 255.255.255.0,Does qnx has special strategy for route table?Which should I change?

Your commands above do not have a subnet mask listed. By default, a class C network would have the mask 255.255.255.0, but you are not using a class C network. You are using a class A network, which by default has the mask 255.0.0.0. I’m not 100% sure about this, but if you changed your IP’s to 192.168.. I think the problem would disappear.

Do you mean that I should change as below?
route add 10.50.23.4 10.62.0.14 255.0.0.0
route add 10.50.22.4 10.62.66.94 255.0.0.0

Do you mean that I should change as below?
Well no, if anything you would use 255.255.255.0 as the mask, but I don’t think that will work either.

I can’t find documentation that shows the route command using a mask parameter.
I think you would have to setup the mask with ifconfig.

Let me try again, you say you are trying to connect different IP addresses through different gateways.
I think the problem is that both of those IP addresses are on the same class A network. Let me make
an analogy that might help.

Let’s say you want to connect to 192.168.1.1 through gateway 1, and 192.168.1.2 through gateway 2.
Unsurprisingly, you can only create on channel, because as far as the underlying software is concerned,
both of these IP are on the same class C network. Does that help?

I don’t know how to fix this if you insist on using a class A network, but there no doubt is a way.

help me,please!!!

post:
/sbin/ifconfig -a
netstat -rn

maschoen,Do you mean that I should setup only one channel of one gateway for IP 10.62.0.9 AND 10.62.66.81?
route add 10.50.23.4 10.62.0.14 //A
route add 10.50.22.4 10.62.66.94 //B

SHOULD CHANGED AS
route add 10.50.23.4 10.62.0.14
route add 10.50.22.4 10.62.0.14
OR
route add 10.50.23.4 10.62.66.94
route add 10.50.22.4 10.62.66.94

but i think 10.62.0.9 and 10.62.66.81 should belong to different network using netmask 255.255.255.0,Is it right?

To the first question, no.
To the second question, no they can belong to different sub-nets, but they are part of the same net.
Why don’t you take noc’s advice and post the results.

please see the bmp attached,sorry i can’t simulate the two gateway at home

Looks like your routing table is all messed up.

Your QNX box has the netmask of 255.255.255.0. Do the two target machines 10.50.23.4 and 10.50.22.4 also use the netmask 255.255.255.0 ?

If all of them are using 255.255.255.0, here is the command to add the routes:

route add -net 10.50.23 -netmask 255.255.255.0 10.62.0.14
route add -net 10.50.22 -netmask 255.255.255.0 10.62.66.94

That should solve your problem.

noc,i do just as you say,both of the two gatway is binded to en1(i use netstat -rn to look the interface),normally it should be binded to en1 and en2,it is the same as i set before,why?

it’s strange that if I change the 10.x.x.x to another network,it can work,maschoen, it’s not that i insist on using A network,indeed, it 's customer’s request.Is it possible for the request?

oh,my god,I found it’s ok on complete QNX,by the way I make my own small system by using my build file,Do I lost some config?I have copy all file of /etc on QNX that is OK to my system,but it’s no use,Which should i change?please give me some advice.

in my build i use “io-net -drtl -ptcpip” and in qnx i find it is “io-net -p tcpip”,should I set the option of io-net?

I found the reason,the broadcast of en1 and en2 is “10.255.255.255”,but they should be “10.62.0.255” and “10.62.66.255”,I don’t know why?

Aggggggggghem! Because you are using a CLASS A network.

maschoen,why in intact QNX it’s OK,I mean that I use QNX CD boot,it’s OK.