Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. how to GATEWAY and DNS Setting? in linux
Forum Update on Monday, May 27th 2025

how to GATEWAY and DNS Setting? in linux

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
commandlinuxqprocess
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForestPoem
    wrote on last edited by ForestPoem
    #1

    Hi.

    my system linux.

    how to IP and MASK and GATEWAY and DNS Setting?

    I use the QProccess?

    If so, what should I Command?

    my source code

    QString ip = ui->lineEdit->text();
    QString mask = ui->lineEdit_2->text();
    QString cmd = QString("ifconfig eth0 %1 netmask %2 up").arg(ip,mask);

            QProcess *qProc = new QProcess(this);
            qProc->execute(cmd);
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      First thing, you need to check that you have the rights to call ifconfig.

      Then you can grab the output from QProcess and parse it to get the data you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved