View topic - Make Static Route Persistent Over Reboots

Make Static Route Persistent Over Reboots

anything that doesn't fit to other groups.

Make Static Route Persistent Over Reboots

Postby webbyz » Thu Sep 27, 2018 6:35 pm

Hello all. I am new when it comes to the QNX level, but we have some building automation controllers that have 2 ethernet ports and the underlying OS is QNX.

The issue that we are having is that only EN0 has a specified Gateway. If I want to route specific traffic out over EN1, then I need to make a static route.

Assuming my target is 1.2.3.4 and EN1 is 192.168.2.1..

When I get to the Shell and do a "route add 1.2.3.4 192.168.2.1" the entry does come up in the "route show" command, but when I reboot the panel, the entry is lost.

Is there a way to make that route persistent over reboots? I cannot find the file where this would be stored and loaded on boot.

Any help is appreciated.
webbyz
New Member
 
Posts: 9
Joined: Thu Sep 27, 2018 5:19 pm

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Sun Sep 30, 2018 8:09 pm

You can put the line

route add 1.2.3.4 192.168.2.1

in the script

/etc/rc.d/rc.local

and it will be executed every time the system boots.
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Re: Make Static Route Persistent Over Reboots

Postby webbyz » Tue Oct 02, 2018 1:34 pm

I don't see that directory. Here is a browser of what I have.

Again I am a QNX Noob. Is there a command that I can run to verify which version of QNX is running on the box? I might be on an odd revision.

https://imgur.com/a/GJueKxJ

Image
webbyz
New Member
 
Posts: 9
Joined: Thu Sep 27, 2018 5:19 pm

Re: Make Static Route Persistent Over Reboots

Postby Tim » Tue Oct 02, 2018 5:05 pm

There are only a few QNX versions (4.X, 6.X and 7.X). You won't have an odd revision, just one of those major ones with a minor X.

Try the following commands:

sin info
pidin info
qconfig

These will work on QNX 6, QNX 7 and I believe QNX 4 (sin command will work on QNX 4 for sure). Then let us know what it says.

Tim
Tim
Senior Member
 
Posts: 1425
Joined: Wed Mar 10, 2004 12:28 am

Re: Make Static Route Persistent Over Reboots

Postby webbyz » Tue Oct 02, 2018 5:39 pm

Looks like 6.4.1?

https://imgur.com/a/AgAmwAO
webbyz
New Member
 
Posts: 9
Joined: Thu Sep 27, 2018 5:19 pm

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Tue Oct 02, 2018 6:02 pm

6.41 is very close in functionality to 6.5. All the QNX 6's to my knowledge used a convention that startup files were in /etc/rc.d. Files in this directory were all prefixed by pr. The main script file was rc.sysinit. rc.local was the intended place that you put local commands so that if you upgraded the system, it would not be overwritten.

Note I said by convention. There is no reason that someone configuring a system, especially an embedded system needs to use this convention. Here are the startup steps that occur in booting QNX 6 from a hard drive.

1) The bios reads in the first second which is a partition loader and jumps into it. The code uses the bios to read the disk and looks for the active partition and then loads the first sector of this partition and jumps to it. It also throws up a option to choose a different partition. That's if you are using the QNX loader.

2) The partition loader looks in the partition for a file .boot or a directory .boot. In the later case things get a little more complicated but basically a boot file is loaded into memory and jumped to.

3) The system is initialized. The steps involved are documented, but basically the kernel is started and it starts running script. The residue of the script can be dumped from directory /proc/boot. By convention at the end of that script a disk driver has been loaded, the QNX partition has been mounted and the script /etc/rc.d/rc.sysinit is started.

The end of step 3 is where your problem is. If you don't have the boot build file you don't know what is happening. It would be challenging for a novice to figure out. If another script is run then that is what you need to update. It is possible that the entire startup is all within the .boot file in which case you would need to update the build file, which you might not have, rebuild it and copy it into place. These are things you should not attempt unless you know what you are doing.
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Re: Make Static Route Persistent Over Reboots

Postby webbyz » Tue Oct 02, 2018 6:16 pm

Yeah most of that is going to be over my head.

I do see a net.cfg file that holds the IP information for the EN0/1 ports.

Could I put anything in there?

Here is what I see in the file....

[global]
hostname Panel109
nameserver 192.168.1.1
route 192.168.1.1

[en0]
type ethernet
mode manual
manual_ip 192.168.1.109
manual_netmask 255.255.255.0

[en1]
type ethernet
mode manual
manual_ip 192.168.2.109
manual_netmask 255.255.255.0
webbyz
New Member
 
Posts: 9
Joined: Thu Sep 27, 2018 5:19 pm

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Tue Oct 02, 2018 6:34 pm

A good suggestion, but I don't think so. net.cfg is maintained by a Photon GUI program called phlip. You can edit the file yourself. Looking at the window phlip puts up I can see that you can add additional IP's to the gateway in the like listed as "route" but there isn't anything to set up a specific route.
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Re: Make Static Route Persistent Over Reboots

Postby webbyz » Tue Oct 02, 2018 6:54 pm

My issue is that I don't know the Syntax to add. I don't have access to use Phlip. So if anyone could let me know what would be added into that file, it would be great.

Based on this... https://imgur.com/a/vFp0rtl

I would think that Gateway would be 192.168.2.1 / Destination would be 1.2.3.4 / and Netmask would be 255.255.255.255. And then if someone did an add, what would it add to that file?

Again I have no way to test that.
webbyz
New Member
 
Posts: 9
Joined: Thu Sep 27, 2018 5:19 pm

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Tue Oct 02, 2018 7:18 pm

The net.cfg file doesn't seem to have the facility to put in a route other than the gateway.

I think the obvious solution is to contact the provider of this device and find out if they give you any way to make the change you desire.
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Re: Make Static Route Persistent Over Reboots

Postby Tim » Tue Oct 02, 2018 7:42 pm

This old post

https://openqnx.com/phpbbforum/viewtopic.php?t=6688

suggests you can add the routes to net.cfg and the netmanager will pick them up. That implies that netmanger was used to configure TCPIP (it only runs once then exits so we can't know if it was used but its quite likely it was).

Tim
Tim
Senior Member
 
Posts: 1425
Joined: Wed Mar 10, 2004 12:28 am

Re: Make Static Route Persistent Over Reboots

Postby nico04 » Wed Oct 03, 2018 6:50 am

Your system runs on PPC, this means it is not a PC based system. So the boot process is different than the one explained by maschoen.
Do you have knowledge of the hardware ? Do you know which peripheral it boots from (SDcard, FLASH memory...) ?
More importantly, do you have the BSP sources for your hardware ?
nico04
Senior Member
 
Posts: 113
Joined: Wed Sep 29, 2010 9:59 am
Location: France

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Wed Oct 03, 2018 10:07 am

Nico,

I completely missed that. What did you see in the post that indicated this. Ouch, so PPC was still available in 6.41? I'm surprised.

Mitchell
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Re: Make Static Route Persistent Over Reboots

Postby nico04 » Wed Oct 03, 2018 12:19 pm

Mitchell,

This is visible in the picture posted by the op in this message : https://openqnx.com/phpbbforum/posting.php?mode=reply&f=10&t=16114#pr59131
PPC is supported till 6.5.0 (inclusive). Releases 6.6.0 and upper support only x86 and arm platforms.

Nicolas
nico04
Senior Member
 
Posts: 113
Joined: Wed Sep 29, 2010 9:59 am
Location: France

Re: Make Static Route Persistent Over Reboots

Postby maschoen » Wed Oct 03, 2018 5:32 pm

This is a link to reply on openqnx, but I'll take your word for it, there is a photo,

Thanks
maschoen
QNX Master
 
Posts: 2691
Joined: Wed Jun 25, 2003 5:18 pm

Next

Return to General Programming

Who is online

Users browsing this forum: No registered users and 7 guests