Août 122013
 

Here below a quick how to use an arduino and a cheap enc28j60 ethernet module (5€).

Can be handy to built a quick web server and some sensors (like a ds18b20 for example).

below the wiring :

enc28j60_bb

below a sketch using the ethercard library (provided with Arduino GUI) :

// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30  http://opensource.org/licenses/mit-license.php
 
#include 

#define STATIC 0  // set to 1 to disable DHCP (adjust myip/gwip values below)

#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,200 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#endif

// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500]; // tcp/ip send and receive buffer

char page[] PROGMEM =
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
""
  ""
    "my web page"
  ""
  ""
    "

hello world !

" "" "" ; void setup(){ Serial.begin(38400); Serial.println("\n[backSoon]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); #if STATIC ether.staticSetup(myip, gwip); #else if (!ether.dhcpSetup()) Serial.println("DHCP failed"); #endif ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); } void loop(){ // wait for an incoming TCP packet, but ignore its contents if (ether.packetLoop(ether.packetReceive())) { memcpy_P(ether.tcpOffset(), page, sizeof page); ether.httpServerReply(sizeof page - 1); } }
 Posted by at 14 h 21 min
Août 122013
 

I have been playing with pxe booting for a while, first starting with pxelinux, then gpxe and lately with ipxe.

I am mostly a windows user and as an IT often needs a quick (=no install) and portable (=run from USB) dhcp server including a tftp server and a http server offering me then pxe booting.
I could use tftp32 or serva but i like to make my own tools and these 2 were missing some features here and there.

So here comes a small portable dhcp server including a tftp and a http server.

This is freeware (and will always be), should be opensource and the unique here idea is to share and contribute.

-dhcp daemon supports an alternative filename based on the user-class thus enabling chainloading (gpxe->pxelinux, ipxe->script, etc), and also support settings dhcp options (which can then be used by your boot loader)
-tftp daemon supports tsize and blksize commands.
-http daemon support head, range (mandatory for ipxe sanboot options) and over 2gb iso.
-new in version 1.0.0.7 : BINL (RIS & WDS) support
-new in version 1.0.0.10 : DNS daemon

The root home of tftp and http is the folder where you main pxe loader sits.
I put all my iso files in a sub folder called images.
I put all my wim files in a sub folder called sources.
I put all my other loaders, in case I want to chain load, in next to my main loader (bootmgr, pxelinux, gpxe, grldr, etc)

In the attached screenshot, i load ipxe then chainloads a script (menu.ipxe).
In the script 3 different methods : the classic memdisk, a newer approach with sanboot and a new kid on the block wimboot.

More info about these loading methods here :
http://www.syslinux.org/wiki/index.php/MEMDISK
http://ipxe.org/cmd/sanboot
http://ipxe.org/wimboot

Side note about ipxe+sanboot+http : I am big fan.
I have always been looking for a quick and efficient boot from lan methods and this is one is great : executes as it read and faster than memdisk since no preloading of the ISO is required.
iPXE reaches 50/60 MBits/secs on my lan.

« Voila ».

Download : http://reboot.pro/files/file/303-tiny-pxe-server/

Erwan

 Posted by at 13 h 38 min
Août 122013
 

Why go for such an arduino when the Uno and Nano are available?
First because it is much smaller, then because it also uses much less power (due to the missing FTDI chip).

The pro mini can be found here for about 6 € : http://dx.com/p/178183 .
The usb dongle can be found here for about 2 € : http://dx.com/p/149859 .

Below the wiring. As mentionned, since the usb dongle does not have a reset feature, press reset on the arduino right between the compiling and uploading part in the Arduino Gui.

pro_mini_programming_alternate_bb.

In the Arduino Gui, dont forget to select the right card i.e « arduino pro or pro mini 5v / 16 mhz / atmega328).

Voila!

Erwan

 Posted by at 13 h 35 min