You can upload to your Arduino board over Ethernet if you flash it with a special bootloader named Ariadne.
You will need an Ethernet module or shield that uses the W5100, W5200, or W5500 Ethernet controller chip. You can not use the ENC28J60 Ethernet controller with Ariadne.
You will need an ISP programmer to burn the Ariadne bootloader to your Arduino board. If you don't own an ISP programmer, you can use a spare Arduino board as an "Arduino as ISP" programmer. If you're going to purchase an ISP programmer, I recommend the 6 pin USBasp. The USBasp works well with the Arduino IDE and is very reasonably priced. You can buy them on eBay.
A description of how the Ariadne upload over Ethernet process works:
- Compile the sketch you want to upload.
- Use avr-objcopy to convert the .hex file of the sketch generated from the Arduino IDE compilation into a binary (.bin) file.
- Reset the Arduino board to activate the bootloader code. You could do this by pressing the reset button on the board but the need to have physical access to the board negates much of the advantages of uploading over Ethernet. For this reason, the upload will typically be accomplished by sending a command to your Arduino board which triggers the application to reset the microcontroller by activating the watchdog timer and then allowing it to time out. There is a library named EthernetReset bundled with the Ariadne hardware package for this purpose, but you can easily implement your own solution if you have other needs.
- Start a TFTP upload of the .bin file to the IP address of your Arduino board within the 10 seconds that the bootloader is activated after the reset. The upload doesn't need to finish within the 10 second window, it only needs to start.
You can get the Ariadne bootloader, as well as detailed instructions, here:
https://github.com/loathingKernel/ariadne-bootloader