Провайдер не даёт подключиться к серверу с платы Ethernet w5100

Тема в разделе "Arduino & Shields", создана пользователем dimaystinov, 26 май 2019.

?

Кто с этим сталкивался?

  1. Только ты

    1 голосов
    100,0%
  2. Было дело

    0 голосов
    0,0%
  3. Ни разу такого не было

    0 голосов
    0,0%
  1. dimaystinov

    dimaystinov Нуб

    Вопрос в том каким образом пройти авторизацию у провайдера?
    Есть логин и пароль от личного кабинета провайдера

    Вот что выдаёт com 4
    HTML:
    nitialize Ethernet with DHCP:
      DHCP assigned IP 10.55.30.189
    connecting...
    HTTP/1.1 511 Network Authentication Required
    Content-Type: text/html;charset=UTF-8

    <html>
    <head>
    <title>МФТИ-Телеком - Авторизация</title>
    <meta http-equiv="refresh" content="0; url=https://login.mipt-telecom.ru/"
    </head>
    <body>
    <table width=90% align=center>
    <tr>
    <td colspan="2">
    <p>&nbsp;</p>
    <h4 align=center>Необходимо пройти авторизацию:</h4>
    <center><button style="font-size:200%; text-align:center; padding: 10px 30px;" onClick="window.location='https://login.mipt-telecom.ru'">АВТОРИЗАЦИЯ</button></center>
    </td>
    </tr>
    <tr>
    <td>&copy;&nbsp;2001-2017 МФТИ</td>
    </tr>
    </table>
    </body>
    </html>
    Код примера:
    Код (C++):

    #include <SPI.h>
    #include <Ethernet.h>

    // assign a MAC address for the ethernet controller.
    // fill in your address here:
    byte mac[] = {
      0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    };
    // Set the static IP address to use if the DHCP fails to assign
    IPAddress ip(10,55,30,105);
    IPAddress myDns(10,55,30,105);

    // initialize the library instance:
    EthernetClient client;

    char server[] = "[URL='http://www.arduino.cc']www.arduino.cc[/URL]";  // also change the Host line in httpRequest()
    char server2[] = "[URL='http://www.arduino.cc']www.arduino.cc[/URL]";
    //IPAddress server(64,131,82,241);

    unsigned long lastConnectionTime = 0;           // last time you connected to the server, in milliseconds
    const unsigned long postingInterval = 10*1000;  // delay between updates, in milliseconds

    void setup() {
      // You can use Ethernet.init(pin) to configure the CS pin
      //Ethernet.init(10);  // Most Arduino shields
      //Ethernet.init(5);   // MKR ETH shield
      //Ethernet.init(0);   // Teensy 2.0
      //Ethernet.init(20);  // Teensy++ 2.0
      //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
      //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

      // start serial port:
      Serial.begin(9600);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
      }

      // start the Ethernet connection:
      Serial.println("Initialize Ethernet with DHCP:");
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Failed to configure Ethernet using DHCP");
        // Check for Ethernet hardware present
        if (Ethernet.hardwareStatus() == EthernetNoHardware) {
          Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
          while (true) {
            delay(1); // do nothing, no point running without Ethernet hardware
          }
        }
        if (Ethernet.linkStatus() == LinkOFF) {
          Serial.println("Ethernet cable is not connected.");
        }
        // try to congifure using IP address instead of DHCP:
        Ethernet.begin(mac, ip, myDns);
        Serial.print("My IP address: ");
        Serial.println(Ethernet.localIP());
      } else {
        Serial.print("  DHCP assigned IP ");
        Serial.println(Ethernet.localIP());
      }
      // give the Ethernet shield a second to initialize:
      delay(1000);
    }

    void loop() {
      // if there's incoming data from the net connection.
      // send it out the serial port.  This is for debugging
      // purposes only:
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
      }

      // if ten seconds have passed since your last connection,
      // then connect again and send data:
      if (millis() - lastConnectionTime > postingInterval) {
        httpRequest();
      }

    }

    // this method makes a HTTP connection to the server:
    void httpRequest() {
      // close any connection before send a new request.
      // This will free the socket on the WiFi shield
      client.stop();

      // if there's a successful connection:
      if (client.connect(server, 80)) {
        Serial.println("connecting...");
        // send the HTTP GET request:
        client.println("GET /latest.txt HTTP/1.1");
        client.println("Host: [URL='http://www.arduino.cc']www.arduino.cc[/URL]");
        client.println("User-Agent: arduino-ethernet");
        client.println("Connection: close");
        client.println();

        // note the time that the connection was made:
        lastConnectionTime = millis();
      } else {
        // if you couldn't make a connection:
        Serial.println("connection failed");
      }
    }
     
     
    Последнее редактирование: 26 май 2019
  2. parovoZZ

    parovoZZ Гуру

    Кажется мне, что это неявная реклама провайдера.
    Самое простое - купить роутер. Выходить через него. Пусть он авторизуется.
     
  3. Зайдите с любого устройства. потом в скетче выставьте мак этого устройства.
    Но вообще, конечно, это дело лучше ставить за роутер, иначе вам дуню только сканерами повалят.
     
    dimaystinov нравится это.
  4. NikitOS

    NikitOS Король шутов Администратор

    Вам напомнить куда код пихать?
     
  5. dimaystinov

    dimaystinov Нуб

    Сейчас попробую. Интересно получится ли
     
  6. dimaystinov

    dimaystinov Нуб

    ответ ардуины на com порт это код?
     
  7. NikitOS

    NikitOS Король шутов Администратор

    А закреплённое сообщение почитать?
     
  8. таким образом, на устройстве, с которого зашли и на шилде, будет один и тот-же мак.
    Может лучше наоборот?
    Установить мак из скетча для сетевой карты ПК, зайти с ПК, затем настройки на ПК вернуть на место.
     
  9. dimaystinov

    dimaystinov Нуб

    Дядя Витя, спасибо. Всё получилось! Парсит веб страницу! Ура. Спасбо огромное
     
  10. dimaystinov

    dimaystinov Нуб

    тогда и с ноутбука не получится пройти авторизацию у провайдера. У него же записан mac адрес ноутбука и для этого mac адреса разрешен вход в сеть. По другому mac адресу я в сеть не зайду
     
  11. Выключаете ардуину, устанавливаете мак из скетча в настройки сетевой карты ПК, при попытке открыть любую страницу в и-нете, провайдер предлагает выполнить авторизацию.
    На ПК делаете абсолютно то, что и прежде, только для мака из скетча.

    П.С.
    Вы для мак-а используете dead beef feed - еда для дохлой говядины, может этот мак немножко не любят провайдеры?