How can I get the Linux Synthetic Target to use DHCP?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I get the Linux Synthetic Target to use DHCP?

Michael Bergandi
Hi all,

I am doing trying to do some testing and development on a network
application with the synthetic Linux target. I have managed to get the
network interface working with a static IP, but not with DHCP. DHCP
eventually just times out. I built the host tools and ecos on Ubuntu
10.04.1 LTS.

For reference, the following are the commands I used to build the
synthetic target:

$ mkdir synthbuild
$ cd synthbuild
$ ecosconfig new linux
$ ecosconfig add fileio net freebsd_net eth_drivers
$ ecosconfig tree
$ make

Here is a simple hello world network app that I am using to get it working:

/* this is a simple hello world program */
#include "stdio.h"
#include "network.h"
#include "cyg/kernel/kapi.h"

int main(void)
{

  init_all_network_interfaces();

  printf("Hello, eCos world!\n");
  while (1) {
    printf ("Sleeping\n");
    cyg_thread_delay (200);
  }

  return 0;
}

You can replace the hello.c in examples and build it like you would
the examples. The command line I am using to run it is:

$ ./hello-net -io -t
/usr/local/libexec/ecos/devs/eth/synth/ecosynth/current/ethernet.tdf

I eventually get a "BOOTP/DHCP failed on eth0" message.

Can someone help me fill in the missing pieces?

Thanks,

--
Mike
Reply | Threaded
Open this post in threaded view
|

Re: How can I get the Linux Synthetic Target to use DHCP?

Sergei Gavrikov-4
On Tue, 4 Jan 2011, Michael Bergandi wrote:

> Hi all,
>
> I am doing trying to do some testing and development on a network
> application with the synthetic Linux target. I have managed to get the
> network interface working with a static IP, but not with DHCP. DHCP
> eventually just times out. I built the host tools and ecos on Ubuntu
> 10.04.1 LTS.
>
[snip]

> $ ./hello-net -io -t
> /usr/local/libexec/ecos/devs/eth/synth/ecosynth/current/ethernet.tdf
>
> I eventually get a "BOOTP/DHCP failed on eth0" message.
>
> Can someone help me fill in the missing pieces?

Hi Michael,

If you use an original 'ethernet.tdf' config file

That is

% egrep -v '(#|^\s*$)' $ECOS_REPOSITORY/devs/eth/synth/ecosynth/current/host/ethernet.tdf

synth_device ethernet {
    eth0 ethertap tap3 00:FE:42:63:84:A5
    max_buffer 32
}

Let's notice that *ethertap* tap3 interface is used there.

Have you configured 'tap3' interface? Have you configured DHCP server on
the interface? If you done it, Can you get IP address from DHCP pool on
the interface:

% sudo dhclient3 tap3

There should be no surprise for you that if you want to use DHCP for
synthetic target you have to configure and networking too.

Well, I can guide how to get it working on Ubuntu, but I doubt that this
list is the appropriate place for this.


Sergei
Reply | Threaded
Open this post in threaded view
|

Re: How can I get the Linux Synthetic Target to use DHCP?

Michael Bergandi
Sergei,

> If you use an original 'ethernet.tdf' config file
>
> That is
>
> % egrep -v '(#|^\s*$)' $ECOS_REPOSITORY/devs/eth/synth/ecosynth/current/host/ethernet.tdf
>
> synth_device ethernet {
>    eth0 ethertap tap3 00:FE:42:63:84:A5
>    max_buffer 32
> }
>
> Let's notice that *ethertap* tap3 interface is used there.

Yes, I get the tap3 created.

tap3      Link encap:Ethernet  HWaddr b2:13:57:48:9e:f3
          inet6 addr: fe80::b013:57ff:fe48:9ef3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:7650 (7.6 KB)  TX bytes:10945 (10.9 KB)

> Have you configured 'tap3' interface?

$ ifconfig tap3 up
$ ifconfig tap3

tap3      Link encap:Ethernet  HWaddr f6:9d:ca:9d:df:8c
          inet6 addr: fe80::f49d:caff:fe9d:df8c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:4788 (4.7 KB)  TX bytes:308 (308.0 B)

> Have you configured DHCP server on the interface? If you done it, Can you get IP address from DHCP pool on  the interface:

This is the problem. I am on a network which is running a dhcp server.
I don't have a specific dhcp server running on the host to handle only
that interface. Is that required?

Do I need to bridge the tap3 interface with an eth0/eth1 to get an
address from the dhcp server on the network?

> % sudo dhclient3 tap3

This just does what the hello-net app is already doing. No surprise,
it never gets an address either.

> There should be no surprise for you that if you want to use DHCP for
> synthetic target you have to configure and networking too.

Yeah, I expected to have to configure the networking some how.
Unfortunately, this is not in any of the documentation. I would expect
that there would at least be some mention of using dhcp with a
networked synthetic target app. Maybe even generalized steps for
getting your host configured to get it working.


> Well, I can guide how to get it working on Ubuntu, but I doubt that this
> list is the appropriate place for this.

That would be great.

I do think that this and probably the user list is the appropriate
place to address usage issue resulting from deficiencies in
documentation. Perhaps I can contribute some documentation once we get
this worked out.


--
Mike
Reply | Threaded
Open this post in threaded view
|

Re: How can I get the Linux Synthetic Target to use DHCP?

Sergei Gavrikov-4
On Wed, 5 Jan 2011, Michael Bergandi wrote:

> Sergei Gavrikov wrote:
> > Well, I can guide how to get it working on Ubuntu, but I doubt that
> > this list is the appropriate place for this.
>
> That would be great.
>
> I do think that this and probably the user list is the appropriate
> place to address usage issue resulting from deficiencies in
> documentation. Perhaps I can contribute some documentation once we get
> this worked out.

I catch the world :-)

Michael,

As you could see I redirected the thread to eCos Discuss List
http://ecos.sourceware.org/ml/ecos-discuss/2011-01/msg00013.html
and paste some SYNOPSIS on the subject, I hope (sure) you will get more
hands from community then.

Sergei