Problem with default gateway

Ilya Alexeev ilya at continuum.ru
Wed Jul 17 16:27:52 UTC 2002


Hi all.

I have the problem:

I must connect RTEMS box with the LINUX box through
their Ethernet interfaces, after that
RTEMS box must be default gateway for the LINUX box, and
LINUX box must be default gateway for the RTEMS box.

Ethernet interfaces of my boxes must has
IP addresses from different networks - that is the problem for RTEMS.

For example,
RTEMS interface have the IP address = 192.168.0.1 / 24
Linux interface have the IP address = 192.168.10.1 / 24

In the Linux box, I enter the following commands:
    route add -net 192.168.0.0 netmask 255.255.255.0 eth0
This command says that network 192.168.0.0./24 is directly connected to the eth0.
    route add default gw 192.168.0.1
This command assigns default gateway.
And everything is fine.

In the RTEMS box, I do the following:
    rtems_bsdnet_rtrequest(
        RTM_ADD,
        192.168.10.0,   // address
        192.168.0.1,    // gateway
        255.255.255.0,  // netmask
        RTF_UP | RTF_STATIC);
This command says that network 192.168.10.0/24 is directly connected to the eth0
(192.168.0.1 is address of the eth0 interface).
After that command RTEMS box can ping the Linux box!
But there is no default gateway yet, so I try to do following:
    rtems_bsdnet_rtrequest(
        RTM_ADD,
        0.0.0.0,
        0.0.0.0,
        192.168.10.1,
        RTF_UP | RTF_STATIC | RTF_GATEWAY);
But nothing happens :(
rtrequest function can't understand that the 192.168.10.1 is
directly reachable from the eth0.

What I am doing wrong?
How to assign default route through such "almost" directly connected network?
Can anyone help me?

Best regards,
Ilya

Sorry for my English.



Ilya V. Alexeev
ilya at continuum.ru

Continuum Plus JSC
Yaroslavl, Russia
Phone: (+7)0852 240200
Fax:   (+7)0852 359977




More information about the users mailing list