Port Forwarding Problem

Hello everyone,

i am controlling an STK600(atmega2560) with a code provided for the Arduino Mega 2560 via the Arduino IDE. The project is about to create a simple web page. I have done the most of it but when i try to do the port forwarding so as to access the host microcontroller from anywhere else nothing happens. I will attach you the code i am using plus an image from my router settings.

#include <EtherCard.h>

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

// ethernet interface ip address
static byte myip[] = { 192,168,1,10 };
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
// 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 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
    "Service Temporarily Unavailable"
    "<h3>This service is currently unavailable</h3>"
      "The main server is currently off-line.
      "Please try again later."

void setup(){
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);
  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

  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);

Any thoughts? :stuck_out_tongue:

Any thoughts? :stuck_out_tongue:

The client is using the wrong hostname, or the hostname it is using has not resolved to the correct address, of the address you’re using is wrong, or the port is wrong, or port forwarding hasn’t been set up correctly, or there is a firewall somewhere between the client and server which is blocking the connection, or you do not have a route from your router to your Arduino, or the Arduino is not listening to the port you are trying to use on the address you are trying to use.

None of these are Arduino issues.

Best to eliminate the web browser and NAT setup for now.

From your command prompt (computer on the same network), do:

telnet 80

Then type:

GET / HTTP/1.0
<hit return to send a blank line>

See if it responds. If it just sits at “Trying…” then it’s not even able to connect to the Arduino.