[SOLVED]set addresses in linux
Hi I have seen a lot of exampels wher the command is
- QString ip = ui->txtAdress->text();
and not this
the Iface doesn’t seem to work but on debians configuration for static IP they recommend this method
What should I use
That depends heavily on the distribution you are using and the network management method used.
Some distributions use the bare utilities (ifconfig — already deprecated in some distributions — or the newer ip), others configure the interface via text files and startup scripts (with or without additional command line utilities), others still use network manager and of course there is always the not so widely used ConnMan.
So you got lots of different ways to do what you want:-) Some require you to run some command(s), others are available via D-Bus interfaces. Of course you may (or may not when using Network Manager or ConnMan) require root access to do this.
Why would you even want to change the IP in the first place?
ifconfig is the widely adopted program to manage NICs. It can slightly change in its syntax, but that is the command to go if you need to be as much portable as possible. Other ways rely heavily on the distribution and will nullify the adoption of Qt as cross platform!
By the way, while it is true that each distribution as its own way to set up addresses (text files, nm, scripts,…) each one must obey the ifconfig command.