[Redirected from ecos-devel] On Wed, 5 Jan 2011, Michael Bergandi wrote:
> 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, I attach one-page SYNOPSYS (I wrote it in a past for myself to remember details :-). Of course, I had the simplest environment (a standalone WS) HTH Sergei eCos-synthetic-networking+DHCP+Ubuntu About This is a short SYNOPSYS without any gory details! Install User Mode Linux utilities There is an utility (tunctl) to manage persistent TUN/TAP interfaces. % sudo aptitude install uml-utilities Configure TAP interface • Add to /etc/network/interfaces auto tap0 iface tap0 inet static address 10.1.1.1 netmask 255.255.255.0 pre-up /usr/sbin/tunctl -t tap0 Test new TAP interface 1. ifup % sudo ifup tap0 Set 'tap0' persistent and owned by uid 0 2. ifconfig % ifconfig -a tap0 tap0 Link encap:Ethernet HWaddr 5a:09:c7:66:88:8d inet addr:10.1.1.1 Bcast:10.1.1.255 Mask:255.255.255.0 ... 3. ping % ping -c 4 10.1.1.1 PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data. 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.110 ms 64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.097 ms 64 bytes from 10.1.1.1: icmp_seq=3 ttl=64 time=0.098 ms 64 bytes from 10.1.1.1: icmp_seq=4 ttl=64 time=0.094 ms --- 10.1.1.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.094/0.099/0.110/0.013 ms Install DHCP client and server Perhaps, you have got it installed. Check that there is no listener for port # 67 (bootps port). % netstat -lun | grep ":67" If you have seen no output, intstall DHCP stuff: % sudo aptitude install dhcp3-{server,client} Configure DHCP server • Add to /etc/dhcp3/dhcpd.conf subnet 10.1.1.0 netmask 255.255.255.0 { range 10.1.1.10 10.1.1.19; } • Either edit /etc/default/dhcp3-server and set INTERFACES="tap0" • or use dpkg-reconfigure for that % sudo dpkg-reconfigure dhcp3-server • Restart DHCP server % sudo /etc/init.d/dhcp3-server restart Test DHCP server from host • Reqest an address from server % sudo dhclient3 tap0 ... Listening on LPF/tap0/5a:09:c7:66:88:8d Sending on LPF/tap0/5a:09:c7:66:88:8d Sending on Socket/fallback DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 8 DHCPOFFER of 10.1.1.12 from 10.1.1.1 DHCPREQUEST of 10.1.1.12 on tap0 to 255.255.255.255 port 67 DHCPACK of 10.1.1.12 from 10.1.1.1 bound to 10.1.1.12 -- renewal in 255 seconds. • Release got address (optional) % sudo dhclient3 -r tap0 ... Listening on LPF/tap0/5a:09:c7:66:88:8d Sending on LPF/tap0/5a:09:c7:66:88:8d Sending on Socket/fallback DHCPRELEASE on tap0 to 10.1.1.1 port 67 Test DHCP server from eCos 1. Configure eCos % ecosconfig -q new linux net create minimal config file (hw_test.ecm) ## minimal hw_test.ecm file cdl_option CYGPKG_NET_BUILD_HW_TESTS { user_value 1 }; and import this file % ecosconfig import hw_test.ecm 2. Build eCos % ecosconfig tree % make 3. Build DHCP test % make -C net/common/current tests TESTS=tests/dhcp_test 4. Create minimal target definition file (ethernet.tdf) ## minimal ethernet.tdf file synth_device ethernet { eth0 ethertap tap0 11:22:33:44:55:66 max_buffer 32 } 5. Run DHCP test as % ./install/tests/net/common/current/tests/dhcp_test \ -io -nw -t ethernet.tdf and at the end you have to see in a terminal something like below ... BOOTP[eth0] op: REQUEST htype: Ethernet hlen: 6 hops: 0 xid: 0x1b535566 secs: 24 flags: 0x80 hw_addr: 11:22:33:44:55:66 client IP: 0.0.0.0 my IP: 10.1.1.13 server IP: 10.1.1.1 gateway IP: 0.0.0.0 options: DHCP message: 3 REQUEST DHCP server id: 10.1.1.1 DHCP time 51: 600 DHCP time 58: 300 DHCP time 59: 525 subnet mask: 255.255.255.0 domain name: example.org DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28 DHCP option: 39/57.2: 576 DHCP requested ip: 10.1.1.13 $ PASS:<Dhcp test OK> EXIT:<done>
-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss