Assumindo um IP estático, adicione-o em /etc/network/interfaces
auto <interface>
iface <interface> inet static
address <yourIP>
network <yourNetmask>
gateway <yourGateway>
dns-nameservers 103.241.42.2 127.0.0.53
Onde alterar o DNS para que não seja sobrescrito após a reinicialização?
# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 103.241.42.2
nameserver 127.0.0.53
search xx
Eu não sei porque, mas o servidor dns acima é uma merda ..
# dig google.com @103.241.42.2; dig google.com @127.0.0.53; dig google.com @8.8.8.8
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com @103.241.42.2
;; global options: +cmd
;; connection timed out; no servers could be reached
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com @127.0.0.53
;; global options: +cmd
;; connection timed out; no servers could be reached
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40430
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 299 IN A 172.217.26.78
;; Query time: 15 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Jun 16 16:17:59 WIB 2017
;; MSG SIZE rcvd: 55
Assumindo um IP estático, adicione-o em /etc/network/interfaces
auto <interface>
iface <interface> inet static
address <yourIP>
network <yourNetmask>
gateway <yourGateway>
dns-nameservers 103.241.42.2 127.0.0.53