Ver Fonte

基本的 tailscale + headscale 部署在公网服务器中

mrh há 1 ano atrás
commit
677c2adaca
8 ficheiros alterados com 1077 adições e 0 exclusões
  1. 2 0
      .gitignore
  2. 8 0
      Caddyfile
  3. 24 0
      demo/Caddyfile
  4. 59 0
      demo/docker-compose.yaml
  5. 15 0
      docker-compose.yaml
  6. 474 0
      gpt.md
  7. 404 0
      headscale/config/config.yaml
  8. 91 0
      readme.md

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+*.deb
+headscale/data

+ 8 - 0
Caddyfile

@@ -0,0 +1,8 @@
+hs.magong.site {
+	# reverse_proxy /web* http://localhost:9811
+	reverse_proxy * http://localhost:27896 {
+		header_down Access-Control-Allow-Origin https://hs.magong.site
+		header_down Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE"
+		header_down Access-Control-Allow-Headers *
+	}
+}

+ 24 - 0
demo/Caddyfile

@@ -0,0 +1,24 @@
+:9811 {
+	@hs-options {
+		host ip6.hs.magong.site
+		method OPTIONS
+	}
+	@hs-other {
+		host ip6.hs.magong.site
+	}
+	handle @hs-options {
+		header {
+			Access-Control-Allow-Origin https://ip6.hs.magong.site
+			Access-Control-Allow-Headers *
+			Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE"
+		}
+		respond 204
+	}
+	handle @hs-other {
+		reverse_proxy http://headscale:8080 {
+			header_down Access-Control-Allow-Origin https://ip6.hs.magong.site
+			header_down Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE"
+			header_down Access-Control-Allow-Headers *
+		}
+	}
+}

+ 59 - 0
demo/docker-compose.yaml

@@ -0,0 +1,59 @@
+version: '3.9'
+
+services:
+  headscale:
+    image: docker.io/headscale/headscale:latest
+    pull_policy: always
+    container_name: headscale
+    restart: unless-stopped
+    command: serve
+    volumes:
+      - ./headscale/config:/etc/headscale
+      - ./headscale/data:/var/lib/headscale
+    # labels:
+    #   - traefik.enable=true
+    #   - traefik.http.routers.headscale-rtr.rule=PathPrefix(`/`) # you might want to add: && Host(`your.domain.name`)"
+    #   - traefik.http.services.headscale-svc.loadbalancer.server.port=8080
+
+  headscale-ui:
+    image: ghcr.io/gurucomputing/headscale-ui:latest
+    pull_policy: always
+    container_name: headscale-ui
+    restart: unless-stopped
+    volumes:
+    # labels:
+    #   - traefik.enable=true
+    #   - traefik.http.routers.headscale-ui-rtr.rule=PathPrefix(`/web`) # you might want to add: && Host(`your.domain.name`)"
+    #   - traefik.http.services.headscale-ui-svc.loadbalancer.server.port=8080
+
+  # traefik:
+  #   image: traefik:latest
+  #   pull_policy: always
+  #   restart: unless-stopped
+  #   container_name: traefik
+  #   command:
+  #     - --api.insecure=true # remove in production
+  #     - --providers.docker
+  #     - --entrypoints.web.address=:80
+  #     - --entrypoints.websecure.address=:443
+  #     - --global.sendAnonymousUsage=false
+  #   ports:
+  #     - 9012:80
+  #     - 9013:443
+  #     - 9811:8080 # web UI (enabled with api.insecure)
+  #   volumes:
+  #     - /var/run/docker.sock:/var/run/docker.sock:ro
+  #     - ./traefik/certificates:/certificates
+  # # caddy:
+  # #     image: caddy:latest
+  # #     # network_mode: host
+  # #     restart: unless-stopped
+  # #     # extra_hosts: 
+  # #     #   - "host.docker.internal:host-gateway"
+  # #     volumes:
+  # #       - /etc/timezone:/etc/timezone
+  # #       - /etc/localtime:/etc/localtime
+  # #       - ./Caddyfile:/etc/caddy/Caddyfile
+  # #     ports:
+  # #       - 9811:9811
+  # #       - 9812:80

+ 15 - 0
docker-compose.yaml

@@ -0,0 +1,15 @@
+version: '3.5'
+services:
+  headscale:
+    image: headscale/headscale:stable
+    container_name: headscale
+    volumes:
+      - /etc/timezone:/etc/timezone
+      - /etc/localtime:/etc/localtime
+      - ./headscale/config:/etc/headscale
+      - ./headscale/data:/var/lib/headscale
+    ports:
+      - 3478:3478
+      - 27896:8080
+    command: serve
+    restart: unless-stopped

+ 474 - 0
gpt.md

@@ -0,0 +1,474 @@
+# DNS 云
+
+tailscale + headscale 部署在公网服务器中,由于在某些云服务器场景,使用 tailscaled 会导致覆盖默认的 /etc/resolv.conf ,导致
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=true --au
+thkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+无法在云服务器  ping mirrors.ivolces.com 
+
+ping mirrors.ivolces.com
+ping: mirrors.ivolces.com: Name or service not known
+(base) root@iv-ydiskxo4xsqc6il525qi:~# dig mirrors.ivolces.com
+
+; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> mirrors.ivolces.com
+;; global options: +cmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 51173
+;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
+
+;; OPT PSEUDOSECTION:
+; EDNS: version: 0, flags:; udp: 65494
+;; QUESTION SECTION:
+;mirrors.ivolces.com.           IN      A
+
+;; AUTHORITY SECTION:
+ivolces.com.            255     IN      SOA     ns1.bytedns.com. dnsadmin.bytedance.com. 2022092021 3600 1200 86400 300
+
+;; Query time: 908 msec
+;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
+;; WHEN: Fri Mar 07 00:34:49 CST 2025
+;; MSG SIZE  rcvd: 115
+resolvectl status
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.2
+       DNS Servers: 100.96.0.2 100.96.0.3
+
+Link 7 (docker0)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 8 (br-2cec65ee2526)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 62 (br-690d297c183d)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 71 (br-c893393fd0f9)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 73 (vethb0dd2c1)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 84 (vethbb1f31e)
+...skipping...
+
+Link 73 (vethb0dd2c1)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 84 (vethbb1f31e)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 85 (br-c1e71b5657db)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 101 (veth0f10628)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 102 (br-eaaee9b7dfcc)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 165 (tailscale0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.100.100.100
+       DNS Servers: 100.100.100.100
+        DNS Domain: h.l ~.
+
+
+
+
+
+
+--------
+
+tailscale + headscale 部署在公网服务器中,由于在某些云服务器场景,使用 tailscaled 会导致覆盖默认的 /etc/resolv.conf ,导致
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=true --au
+thkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+无法在云服务器  ping mirrors.ivolces.com 
+
+后面我在官方文档找到如下解决方案:
+```markdown
+Configuring Linux DNS
+There are an incredible number of ways to configure DNS on Linux.
+
+Tailscale attempts to interoperate with any Linux DNS configuration it finds already present. Unfortunately, some are not entirely amenable to cooperatively managing the host's DNS configuration.
+
+Common problems
+NetworkManager + systemd-resolved
+If you're using both NetworkManager and systemd-resolved (as in common in many distros), you'll want to make sure that /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf. That should be the default. If not,
+
+
+$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
+When NetworkManager sees that symlink is present, its default behavior is to use systemd-resolved and not take over the resolv.conf file.
+
+After fixing, restart everything:
+
+
+$ sudo systemctl restart systemd-resolved
+$ sudo systemctl restart NetworkManager
+$ sudo systemctl restart tailscaled
+DHCP dhclient overwriting /etc/resolv.conf
+Without any DNS management system installed, DHCP clients like dhclient and programs like tailscaled have no other options than rewriting the /etc/resolv.conf file themselves, which results in them sometimes fighting with each other. (For instance, a DHCP renewal rewriting the resolv.conf resulting in loss of MagicDNS functionality.)
+
+Possible workarounds are to use resolvconf or systemd-resolved. Issue 2334 tracks making Tailscale react to other programs updating resolv.conf so Tailscale can add itself back.
+
+Last updated Jan 10, 2025
+```
+在按照文档操作之前,我先查看云服务器内网的 dns 配置:
+sudo tcpdump -i eth0 udp port 53 -n
+tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
+listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
+20:50:12.903647 IP 192.168.0.2.48543 > 100.96.0.3.53: 49478+ A? ntp2.ivolces.com. (34)
+20:50:12.903690 IP 192.168.0.2.50660 > 100.96.0.2.53: 7537+ [1au] AAAA? ntp3.ivolces.com. (45)
+20:50:12.903710 IP 192.168.0.2.58075 > 100.96.0.2.53: 59569+ [1au] AAAA? ntp3.ivolces.com.ivolces.com. (57)
+20:50:12.903728 IP 192.168.0.2.54169 > 100.96.0.2.53: 28381+ [1au] A? ntp3.ivolces.com.ivolces.com. (57)
+20:50:12.903747 IP 192.168.0.2.47311 > 100.96.0.2.53: 2338+ [1au] A? ntp3.ivolces.com. (45)
+20:50:12.903790 IP 192.168.0.2.50133 > 100.96.0.2.53: 4483+ [1au] AAAA? ntp2.ivolces.com. (45)
+20:50:12.904171 IP 100.96.0.2.53 > 192.168.0.2.47311: 2338* 1/0/1 A 100.96.0.13 (77)
+20:50:12.904601 IP 100.96.0.2.53 > 192.168.0.2.50660: 7537* 0/1/1 (131)
+20:50:12.904628 IP 100.96.0.2.53 > 192.168.0.2.54169: 28381 NXDomain* 0/1/1 (143)
+20:50:12.905040 IP 100.96.0.2.53 > 192.168.0.2.50133: 4483* 0/1/1 (131)
+20:50:12.905181 IP 100.96.0.2.53 > 192.168.0.2.58075: 59569 NXDomain* 0/1/1 (143)
+20:50:12.906542 IP 100.96.0.3.53 > 192.168.0.2.48543: 49478* 1/0/0 A 100.96.0.12 (66)
+20:50:15.241190 IP 192.168.0.2.52317 > 100.96.0.2.53: 17060+ [1au] A? mirrors.ivolces.com. (48)
+20:50:15.241237 IP 192.168.0.2.43487 > 100.96.0.2.53: 50457+ [1au] AAAA? mirrors.ivolces.com. (48)
+...
+resolvectl status
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.3
+       DNS Servers: 100.96.0.2 100.96.0.3
+...
+Link 155 (tailscale0)
+Current Scopes: none
+     Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+-----
+
+可见 100. 地址是云服务器的 DNS 域名,里面配置了不少域名不局限于上述显示的这些。
+
+当我启动 tailscale 后:
+```shell
+sudo tailscale up --login-server http://127.0.0.1:27896  --accept-dns=true --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+resolvectl status
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.3
+       DNS Servers: 100.96.0.2 100.96.0.3
+
+...
+Link 155 (tailscale0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.100.100.100
+       DNS Servers: 100.100.100.100
+        DNS Domain: h.l ~.
+
+
+udo tcpdump -i eth0 udp port 53 -n
+tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
+listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
+21:26:46.661078 IP 192.168.0.2.44635 > 100.96.0.3.53: 34904+ [1au] AAAA? open.volcengineapi.com.h.l. (55)
+21:26:46.661133 IP 192.168.0.2.38527 > 100.96.0.3.53: 31188+ [1au] A? open.volcengineapi.com.h.l. (55)
+21:26:46.662072 IP 100.96.0.3.53 > 192.168.0.2.38527: 31188 NXDomain 0/1/1 (130)
+21:26:46.662508 IP 100.96.0.3.53 > 192.168.0.2.44635: 34904 NXDomain 0/1/1 (130)
+21:26:51.661835 IP 192.168.0.2.39804 > 100.96.0.3.53: 29966+ [1au] A? open.volcengineapi.com.h.l. (55)
+21:26:51.661863 IP 192.168.0.2.48489 > 100.96.0.3.53: 48309+ [1au] AAAA? open.volcengineapi.com.h.l. (55)
+...
+```
+- 我想使用 MagicDNS 功能, 如果 --accept-dns=false 参数会导致无法使用该功能对吗?我不希望这样
+- 自定义规则使*.ivolces.com使用内部DNS
+sudo resolvectl domain eth0 ~ivolces.com
+sudo resolvectl dns eth0 100.96.0.2 100.96.0.3
+会导致硬编码 based domain ,是吗?云服务器的域名地址可不仅仅是 ivolces.com ,可能还有其他域名,我不知道是否应该以 IP 100.96.0.2 100.96.0.3 地址为主。
+- 修改 Headscale 服务器的配置文件(例如config.yaml)指定云服务器的DNS 100.96.0.2 100.96.0.3 会导致耦合对吗?这个 dns 地址仅仅是对于本服务器而言,我不想修改 Headscale 硬编码到该台服务器的 DNS
+- 我已经关闭防火墙
+
+根据上述建议,我找到了某个解决方案:
+```shell
+# 为 tailscale0 接口指定专属 DNS 和路由域
+sudo resolvectl dns tailscale0 100.100.100.100
+sudo resolvectl domain tailscale0 ~h.l
+
+# 为 eth0 接口设置默认 DNS(优先级高于全局)
+sudo resolvectl dns eth0 100.96.0.2 100.96.0.3
+sudo resolvectl default-route eth0 yes
+
+# 重启服务
+sudo systemctl restart systemd-resolved tailscaled
+```
+然后在 tailscale 已经启动的情况下,查看状态
+```shell
+resolvectl status
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.2
+       DNS Servers: 100.96.0.2 100.96.0.3
+...
+Link 156 (tailscale0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.100.100.100
+       DNS Servers: 100.100.100.100
+        DNS Domain: h.l ~.
+```
+结果云服务dns仍然不行:
+```shell
+dig @100.96.0.2
+
+; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> @100.96.0.2
+; (1 server found)
+;; global options: +cmd
+;; connection timed out; no servers could be reached
+
+(base) root@iv-ydiskxo4xsqc6il525qi:~/program# sudo tailscale down
+(base) root@iv-ydiskxo4xsqc6il525qi:~/program# dig @100.96.0.2
+
+; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> @100.96.0.2
+; (1 server found)
+;; global options: +cmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29167
+;; flags: qr aa rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1
+
+;; OPT PSEUDOSECTION:
+; EDNS: version: 0, flags:; udp: 1232
+; COOKIE: 4589434174d8d4dc (echoed)
+;; QUESTION SECTION:
+;.                              IN      NS
+
+;; ANSWER SECTION:
+.                       539     IN      NS      i.root-servers.net.
+.                       539     IN      NS      d.root-servers.net.
+.                       539     IN      NS      b.root-servers.net.
+.                       539     IN      NS      e.root-servers.net.
+.                       539     IN      NS      l.root-servers.net.
+.                       539     IN      NS      j.root-servers.net.
+.                       539     IN      NS      k.root-servers.net.
+.                       539     IN      NS      a.root-servers.net.
+.                       539     IN      NS      m.root-servers.net.
+.                       539     IN      NS      f.root-servers.net.
+.                       539     IN      NS      g.root-servers.net.
+.                       539     IN      NS      h.root-servers.net.
+.                       539     IN      NS      c.root-servers.net.
+
+;; Query time: 0 msec
+;; SERVER: 100.96.0.2#53(100.96.0.2) (UDP)
+;; WHEN: Thu Mar 06 21:53:52 CST 2025
+;; MSG SIZE  rcvd: 443
+
+```
+只有 tailscale 启动的时候才会无法 dig 云服务器,
+到底是哪里没配置好导致 tailscale 启动后影响了云服务器默认的 dns 配置。
+
+# fuck
+tailscale + headscale 部署在公网服务器中,由于在某些云服务器场景,使用 tailscaled 会导致覆盖默认的 /etc/resolv.conf ,导致
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=true --au
+thkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+无法在云服务器  ping mirrors.ivolces.com 
+
+后面我在官方文档找到如下解决方案:
+```markdown
+Configuring Linux DNS
+There are an incredible number of ways to configure DNS on Linux.
+
+Tailscale attempts to interoperate with any Linux DNS configuration it finds already present. Unfortunately, some are not entirely amenable to cooperatively managing the host's DNS configuration.
+
+Common problems
+NetworkManager + systemd-resolved
+If you're using both NetworkManager and systemd-resolved (as in common in many distros), you'll want to make sure that /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf. That should be the default. If not,
+
+
+$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
+When NetworkManager sees that symlink is present, its default behavior is to use systemd-resolved and not take over the resolv.conf file.
+
+After fixing, restart everything:
+
+
+$ sudo systemctl restart systemd-resolved
+$ sudo systemctl restart NetworkManager
+$ sudo systemctl restart tailscaled
+DHCP dhclient overwriting /etc/resolv.conf
+Without any DNS management system installed, DHCP clients like dhclient and programs like tailscaled have no other options than rewriting the /etc/resolv.conf file themselves, which results in them sometimes fighting with each other. (For instance, a DHCP renewal rewriting the resolv.conf resulting in loss of MagicDNS functionality.)
+
+Possible workarounds are to use resolvconf or systemd-resolved. Issue 2334 tracks making Tailscale react to other programs updating resolv.conf so Tailscale can add itself back.
+
+Last updated Jan 10, 2025
+```
+
+我按照文档来设置,发现还是不行。
+```shell
+ls -al /etc/resolv.conf
+lrwxrwxrwx 1 root root 37 Mar  6 18:21 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
+sudo systemctl status systemd-resolved
+● systemd-resolved.service - Network Name Resolution
+     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
+     Active: active (running) since Thu 2025-03-06 18:28:57 CST; 8s ago
+ sudo systemctl status tailscaled
+● tailscaled.service - Tailscale node agent
+     Loaded: loaded (/lib/systemd/system/tailscaled.service; enabled; vendor preset: enabled)
+     Active: active (running) since Thu 2025-03-06 18:21:42 CST; 5min ago
+sudo systemctl status NetworkManager
+● NetworkManager.service - Network Manager
+     Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
+     Active: active (running) since Thu 2025-03-06 18:21:36 CST; 6min ago
+```
+```shell
+# tailscale 启动之前:
+cat /etc/resolv.conf
+# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
+# Do not edit.
+#
+# This file might be symlinked as /etc/resolv.conf. If you're looking at
+# /etc/resolv.conf and seeing this text, you have followed the symlink.
+#
+# This is a dynamic resolv.conf file for connecting local clients to the
+# internal DNS stub resolver of systemd-resolved. This file lists all
+# configured search domains.
+#
+# Run "resolvectl status" to see details about the uplink DNS servers
+# currently in use.
+#
+# Third party programs should typically not access this file directly, but only
+# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
+# different way, replace this symlink by a static file or a different symlink.
+#
+# See man:systemd-resolved.service(8) for details about the supported modes of
+# operation for /etc/resolv.conf.
+
+nameserver 127.0.0.53
+options edns0 trust-ad
+search .
+ping mirrors.ivolces.com
+PING mirrors.ivolces.com (100.96.0.22) 56(84) bytes of data.
+64 bytes from 100.96.0.22 (100.96.0.22): icmp_seq=1 ttl=64 time=0.108 ms
+64 bytes from 100.96.0.22 (100.96.0.22): icmp_seq=2 ttl=64 time=0.130 ms
+```
+```shell
+# tailscale 启动之后:
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=true --authkey 90e2d5089
+997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1 
+# tailscale 启动之后:
+cat /etc/resolv.conf
+nameserver 127.0.0.53
+options edns0 trust-ad
+search h.l
+ping mirrors.ivolces.com
+ping: mirrors.ivolces.com: Name or service not known
+```
+甚至当我把参数设置为不接受 dns 的时候,也还是不行。即便我想使用 MagicDNS 因为对我来说很方便。
+```shell
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=false --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+cat /etc/resolv.conf
+nameserver 127.0.0.53
+options edns0 trust-ad
+search .
+ping mirrors.ivolces.com
+ping: mirrors.ivolces.com: Temporary failure in name resolution
+```
+为了进一步查看 dns 管理状态:
+```shell
+sudo tailscale up --login-server https://hs.magong.site  --
+accept-dns=true --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+(base) root@iv-ydiskxo4xsqc6il525qi:~/program/headscale# resolvectl dns tailscale0
+Link 149 (tailscale0): 100.100.100.100
+
+
+sudo tailscale down
+# 设置为 false 时 ,resolvectl dns 没有地址
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=false --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+resolvectl dns tailscale0
+Link 149 (tailscale0):
+```
+进一步检查 resolvectl status
+```shell
+sudo tailscale down
+# 关闭后此时 ping 是起作用的
+ping mirrors.ivolces.com
+PING mirrors.ivolces.com (100.96.0.22) 56(84) bytes of data.
+64 bytes from 100.96.0.22 (100.96.0.22): icmp_seq=1 ttl=64 time=0.117 ms
+
+resolvectl status
+Current Scopes: none
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.2
+       DNS Servers: 100.96.0.2 100.96.0.3
+...
+Link 141 (veth928f8d8)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 149 (tailscale0)
+Current Scopes: none
+     Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+```
+设置tailscale接受 dns 后再次检查:
+```shell
+sudo tailscale up --login-server https://hs.magong.site  --accept-dns=true --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1
+resolvectl status
+Global
+       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+resolv.conf mode: stub
+
+Link 2 (eth0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.96.0.2
+       DNS Servers: 100.96.0.2 100.96.0.3
+
+Link 7 (docker0)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+...
+Link 141 (veth928f8d8)
+Current Scopes: none
+     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+
+Link 149 (tailscale0)
+    Current Scopes: DNS
+         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
+Current DNS Server: 100.100.100.100
+       DNS Servers: 100.100.100.100
+        DNS Domain: h.l ~.
+```
+云服务默认配置依然不起作用:
+```shell
+ping mirrors.ivolces.com
+ping: mirrors.ivolces.com: Name or service not known
+```
+
+请问是什么原因导致我没有配置成功?我明明是按照官方文档来设置的。为什么会干扰到云服务的默认配置?我需要 MagicDNS 同时也需要不要干扰默认系统配置。

+ 404 - 0
headscale/config/config.yaml

@@ -0,0 +1,404 @@
+---
+# headscale will look for a configuration file named `config.yaml` (or `config.json`) in the following order:
+#
+# - `/etc/headscale`
+# - `~/.headscale`
+# - current working directory
+
+# The url clients will connect to.
+# Typically this will be a domain like:
+#
+# https://myheadscale.example.com:443
+#
+server_url: http://localhost:8080
+
+# Address to listen to / bind to on the server
+#
+# For production:
+# listen_addr: 0.0.0.0:8080
+listen_addr: 0.0.0.0:8080
+
+# Address to listen to /metrics, you may want
+# to keep this endpoint private to your internal
+# network
+#
+metrics_listen_addr: 127.0.0.1:9090
+
+# Address to listen for gRPC.
+# gRPC is used for controlling a headscale server
+# remotely with the CLI
+# Note: Remote access _only_ works if you have
+# valid certificates.
+#
+# For production:
+# grpc_listen_addr: 0.0.0.0:50443
+grpc_listen_addr: 127.0.0.1:50443
+
+# Allow the gRPC admin interface to run in INSECURE
+# mode. This is not recommended as the traffic will
+# be unencrypted. Only enable if you know what you
+# are doing.
+grpc_allow_insecure: false
+
+# The Noise section includes specific configuration for the
+# TS2021 Noise protocol
+noise:
+  # The Noise private key is used to encrypt the
+  # traffic between headscale and Tailscale clients when
+  # using the new Noise-based protocol.
+  private_key_path: /var/lib/headscale/noise_private.key
+
+# List of IP prefixes to allocate tailaddresses from.
+# Each prefix consists of either an IPv4 or IPv6 address,
+# and the associated prefix length, delimited by a slash.
+# It must be within IP ranges supported by the Tailscale
+# client - i.e., subnets of 100.64.0.0/10 and fd7a:115c:a1e0::/48.
+# See below:
+# IPv6: https://github.com/tailscale/tailscale/blob/22ebb25e833264f58d7c3f534a8b166894a89536/net/tsaddr/tsaddr.go#LL81C52-L81C71
+# IPv4: https://github.com/tailscale/tailscale/blob/22ebb25e833264f58d7c3f534a8b166894a89536/net/tsaddr/tsaddr.go#L33
+# Any other range is NOT supported, and it will cause unexpected issues.
+prefixes:
+  v4: 100.64.0.0/10
+  v6: fd7a:115c:a1e0::/48
+
+  # Strategy used for allocation of IPs to nodes, available options:
+  # - sequential (default): assigns the next free IP from the previous given IP.
+  # - random: assigns the next free IP from a pseudo-random IP generator (crypto/rand).
+  allocation: sequential
+
+# DERP is a relay system that Tailscale uses when a direct
+# connection cannot be established.
+# https://tailscale.com/blog/how-tailscale-works/#encrypted-tcp-relays-derp
+#
+# headscale needs a list of DERP servers that can be presented
+# to the clients.
+derp:
+  server:
+    # If enabled, runs the embedded DERP server and merges it into the rest of the DERP config
+    # The Headscale server_url defined above MUST be using https, DERP requires TLS to be in place
+    enabled: true
+
+    # Region ID to use for the embedded DERP server.
+    # The local DERP prevails if the region ID collides with other region ID coming from
+    # the regular DERP config.
+    region_id: 999
+
+    # Region code and name are displayed in the Tailscale UI to identify a DERP region
+    region_code: "headscale"
+    region_name: "Headscale Embedded DERP"
+
+    # Listens over UDP at the configured address for STUN connections - to help with NAT traversal.
+    # When the embedded DERP server is enabled stun_listen_addr MUST be defined.
+    #
+    # For more details on how this works, check this great article: https://tailscale.com/blog/how-tailscale-works/
+    stun_listen_addr: "0.0.0.0:3478"
+
+    # Private key used to encrypt the traffic between headscale DERP
+    # and Tailscale clients.
+    # The private key file will be autogenerated if it's missing.
+    #
+    private_key_path: /var/lib/headscale/derp_server_private.key
+
+    # This flag can be used, so the DERP map entry for the embedded DERP server is not written automatically,
+    # it enables the creation of your very own DERP map entry using a locally available file with the parameter DERP.paths
+    # If you enable the DERP server and set this to false, it is required to add the DERP server to the DERP map using DERP.paths
+    automatically_add_embedded_derp_region: true
+
+    # For better connection stability (especially when using an Exit-Node and DNS is not working),
+    # it is possible to optionally add the public IPv4 and IPv6 address to the Derp-Map using:
+    ipv4: 1.2.3.4
+    ipv6: 2001:db8::1
+
+  # List of externally available DERP maps encoded in JSON
+  urls:
+    - https://controlplane.tailscale.com/derpmap/default
+
+  # Locally available DERP map files encoded in YAML
+  #
+  # This option is mostly interesting for people hosting
+  # their own DERP servers:
+  # https://tailscale.com/kb/1118/custom-derp-servers/
+  #
+  # paths:
+  #   - /etc/headscale/derp-example.yaml
+  paths: []
+
+  # If enabled, a worker will be set up to periodically
+  # refresh the given sources and update the derpmap
+  # will be set up.
+  auto_update_enabled: true
+
+  # How often should we check for DERP updates?
+  update_frequency: 24h
+
+# Disables the automatic check for headscale updates on startup
+disable_check_updates: false
+
+# Time before an inactive ephemeral node is deleted?
+ephemeral_node_inactivity_timeout: 30m
+
+database:
+  # Database type. Available options: sqlite, postgres
+  # Please note that using Postgres is highly discouraged as it is only supported for legacy reasons.
+  # All new development, testing and optimisations are done with SQLite in mind.
+  type: sqlite
+
+  # Enable debug mode. This setting requires the log.level to be set to "debug" or "trace".
+  debug: false
+
+  # GORM configuration settings.
+  gorm:
+    # Enable prepared statements.
+    prepare_stmt: true
+
+    # Enable parameterized queries.
+    parameterized_queries: true
+
+    # Skip logging "record not found" errors.
+    skip_err_record_not_found: true
+
+    # Threshold for slow queries in milliseconds.
+    slow_threshold: 1000
+
+  # SQLite config
+  sqlite:
+    path: /var/lib/headscale/db.sqlite
+
+    # Enable WAL mode for SQLite. This is recommended for production environments.
+    # https://www.sqlite.org/wal.html
+    write_ahead_log: true
+
+    # Maximum number of WAL file frames before the WAL file is automatically checkpointed.
+    # https://www.sqlite.org/c3ref/wal_autocheckpoint.html
+    # Set to 0 to disable automatic checkpointing.
+    wal_autocheckpoint: 1000
+
+  # # Postgres config
+  # Please note that using Postgres is highly discouraged as it is only supported for legacy reasons.
+  # See database.type for more information.
+  # postgres:
+  #   # If using a Unix socket to connect to Postgres, set the socket path in the 'host' field and leave 'port' blank.
+  #   host: localhost
+  #   port: 5432
+  #   name: headscale
+  #   user: foo
+  #   pass: bar
+  #   max_open_conns: 10
+  #   max_idle_conns: 10
+  #   conn_max_idle_time_secs: 3600
+
+  #   # If other 'sslmode' is required instead of 'require(true)' and 'disabled(false)', set the 'sslmode' you need
+  #   # in the 'ssl' field. Refers to https://www.postgresql.org/docs/current/libpq-ssl.html Table 34.1.
+  #   ssl: false
+
+### TLS configuration
+#
+## Let's encrypt / ACME
+#
+# headscale supports automatically requesting and setting up
+# TLS for a domain with Let's Encrypt.
+#
+# URL to ACME directory
+acme_url: https://acme-v02.api.letsencrypt.org/directory
+
+# Email to register with ACME provider
+acme_email: ""
+
+# Domain name to request a TLS certificate for:
+tls_letsencrypt_hostname: ""
+
+# Path to store certificates and metadata needed by
+# letsencrypt
+# For production:
+tls_letsencrypt_cache_dir: /var/lib/headscale/cache
+
+# Type of ACME challenge to use, currently supported types:
+# HTTP-01 or TLS-ALPN-01
+# See: docs/ref/tls.md for more information
+tls_letsencrypt_challenge_type: HTTP-01
+# When HTTP-01 challenge is chosen, letsencrypt must set up a
+# verification endpoint, and it will be listening on:
+# :http = port 80
+tls_letsencrypt_listen: ":http"
+
+## Use already defined certificates:
+tls_cert_path: ""
+tls_key_path: ""
+
+log:
+  # Output formatting for logs: text or json
+  format: text
+  level: info
+
+## Policy
+# headscale supports Tailscale's ACL policies.
+# Please have a look to their KB to better
+# understand the concepts: https://tailscale.com/kb/1018/acls/
+policy:
+  # The mode can be "file" or "database" that defines
+  # where the ACL policies are stored and read from.
+  mode: file
+  # If the mode is set to "file", the path to a
+  # HuJSON file containing ACL policies.
+  path: ""
+
+## DNS
+#
+# headscale supports Tailscale's DNS configuration and MagicDNS.
+# Please have a look to their KB to better understand the concepts:
+#
+# - https://tailscale.com/kb/1054/dns/
+# - https://tailscale.com/kb/1081/magicdns/
+# - https://tailscale.com/blog/2021-09-private-dns-with-magicdns/
+#
+# Please note that for the DNS configuration to have any effect,
+# clients must have the `--accept-dns=true` option enabled. This is the
+# default for the Tailscale client. This option is enabled by default
+# in the Tailscale client.
+#
+# Setting _any_ of the configuration and `--accept-dns=true` on the
+# clients will integrate with the DNS manager on the client or
+# overwrite /etc/resolv.conf.
+# https://tailscale.com/kb/1235/resolv-conf
+#
+# If you want stop Headscale from managing the DNS configuration
+# all the fields under `dns` should be set to empty values.
+dns:
+  # Whether to use [MagicDNS](https://tailscale.com/kb/1081/magicdns/).
+  magic_dns: true
+
+  # Defines the base domain to create the hostnames for MagicDNS.
+  # This domain _must_ be different from the server_url domain.
+  # `base_domain` must be a FQDN, without the trailing dot.
+  # The FQDN of the hosts will be
+  # `hostname.base_domain` (e.g., _myhost.example.com_).
+  base_domain: h.l
+
+  # List of DNS servers to expose to clients.
+  nameservers:
+    global:
+      - 1.1.1.1
+      - 1.0.0.1
+      - 2606:4700:4700::1111
+      - 2606:4700:4700::1001
+
+      # NextDNS (see https://tailscale.com/kb/1218/nextdns/).
+      # "abc123" is example NextDNS ID, replace with yours.
+      # - https://dns.nextdns.io/abc123
+
+    # Split DNS (see https://tailscale.com/kb/1054/dns/),
+    # a map of domains and which DNS server to use for each.
+    split:
+      {}
+      # foo.bar.com:
+      #   - 1.1.1.1
+      # darp.headscale.net:
+      #   - 1.1.1.1
+      #   - 8.8.8.8
+
+  # Set custom DNS search domains. With MagicDNS enabled,
+  # your tailnet base_domain is always the first search domain.
+  search_domains: []
+
+  # Extra DNS records
+  # so far only A and AAAA records are supported (on the tailscale side)
+  # See: docs/ref/dns.md
+  # extra_records: 
+  #   - name: "vs2.l"
+  #     type: "A"
+  #     value: "10.0.0.32"
+  #
+  #   # you can also put it in one line
+  #   - { name: "prometheus.myvpn.example.com", type: "A", value: "100.64.0.3" }
+  #
+  # Alternatively, extra DNS records can be loaded from a JSON file.
+  # Headscale processes this file on each change.
+  # extra_records_path: /var/lib/headscale/extra-records.json
+
+# Unix socket used for the CLI to connect without authentication
+# Note: for production you will want to set this to something like:
+unix_socket: /var/run/headscale/headscale.sock
+unix_socket_permission: "0770"
+#
+# headscale supports experimental OpenID connect support,
+# it is still being tested and might have some bugs, please
+# help us test it.
+# OpenID Connect
+# oidc:
+#   only_start_if_oidc_is_available: true
+#   issuer: "https://your-oidc.issuer.com/path"
+#   client_id: "your-oidc-client-id"
+#   client_secret: "your-oidc-client-secret"
+#   # Alternatively, set `client_secret_path` to read the secret from the file.
+#   # It resolves environment variables, making integration to systemd's
+#   # `LoadCredential` straightforward:
+#   client_secret_path: "${CREDENTIALS_DIRECTORY}/oidc_client_secret"
+#   # client_secret and client_secret_path are mutually exclusive.
+#
+#   # The amount of time from a node is authenticated with OpenID until it
+#   # expires and needs to reauthenticate.
+#   # Setting the value to "0" will mean no expiry.
+#   expiry: 180d
+#
+#   # Use the expiry from the token received from OpenID when the user logged
+#   # in, this will typically lead to frequent need to reauthenticate and should
+#   # only been enabled if you know what you are doing.
+#   # Note: enabling this will cause `oidc.expiry` to be ignored.
+#   use_expiry_from_token: false
+#
+#   # Customize the scopes used in the OIDC flow, defaults to "openid", "profile" and "email" and add custom query
+#   # parameters to the Authorize Endpoint request. Scopes default to "openid", "profile" and "email".
+#
+#   scope: ["openid", "profile", "email", "custom"]
+#   extra_params:
+#     domain_hint: example.com
+#
+#   # List allowed principal domains and/or users. If an authenticated user's domain is not in this list, the
+#   # authentication request will be rejected.
+#
+#   allowed_domains:
+#     - h.lc
+#   # Note: Groups from keycloak have a leading '/'
+#   allowed_groups:
+#     - /headscale
+#   allowed_users:
+#    - cxy-magong@qq.com
+#
+#   # Optional: PKCE (Proof Key for Code Exchange) configuration
+#   # PKCE adds an additional layer of security to the OAuth 2.0 authorization code flow
+#   # by preventing authorization code interception attacks
+#   # See https://datatracker.ietf.org/doc/html/rfc7636
+#   pkce:
+#     # Enable or disable PKCE support (default: false)
+#     enabled: false
+#     # PKCE method to use:
+#     # - plain: Use plain code verifier
+#     # - S256: Use SHA256 hashed code verifier (default, recommended)
+#     method: S256
+#
+#   # Map legacy users from pre-0.24.0 versions of headscale to the new OIDC users
+#   # by taking the username from the legacy user and matching it with the username
+#   # provided by the OIDC. This is useful when migrating from legacy users to OIDC
+#   # to force them using the unique identifier from the OIDC and to give them a
+#   # proper display name and picture if available.
+#   # Note that this will only work if the username from the legacy user is the same
+#   # and there is a possibility for account takeover should a username have changed
+#   # with the provider.
+#   # When this feature is disabled, it will cause all new logins to be created as new users.
+#   # Note this option will be removed in the future and should be set to false
+#   # on all new installations, or when all users have logged in with OIDC once.
+#   map_legacy_users: false
+
+# Logtail configuration
+# Logtail is Tailscales logging and auditing infrastructure, it allows the control panel
+# to instruct tailscale nodes to log their activity to a remote server.
+logtail:
+  # Enable logtail for this headscales clients.
+  # As there is currently no support for overriding the log server in headscale, this is
+  # disabled by default. Enabling this will make your clients send logs to Tailscale Inc.
+  enabled: false
+
+# Enabling this option makes devices prefer a random port for WireGuard traffic over the
+# default static port 41641. This option is intended as a workaround for some buggy
+# firewall devices. See https://tailscale.com/kb/1181/firewalls/ for more information.
+randomize_client_port: false

+ 91 - 0
readme.md

@@ -0,0 +1,91 @@
+
+# 安装
+https://headscale.net/stable/setup/install/official/
+
+```shell
+sudo systemctl stop wg-quick@wg
+sudo systemctl disable wg-quick@wg
+sudo ufw allow 41641/udp
+set-proxy
+HEADSCALE_VERSION="0.25.1" # See above URL for latest version, e.g. "X.Y.Z" (NOTE: do not add the "v" prefix!)
+HEADSCALE_ARCH="amd64" # Your system architecture, e.g. "amd64"
+wget --output-document=headscale.deb \
+ "https://github.com/juanfont/headscale/releases/download/v${HEADSCALE_VERSION}/headscale_${HEADSCALE_VERSION}_linux_${HEADSCALE_ARCH}.deb"
+sudo apt install ./headscale.deb
+# 参考 https://github.com/juanfont/headscale/blob/main/config-example.yaml
+sudo vi /etc/headscale/config.yaml
+sudo systemctl start headscale
+sudo systemctl enable headscale
+sudo systemctl status headscale
+# sudo headscale users create mrh
+# User created
+# sudo headscale users list
+
+curl -fsSL https://tailscale.com/install.sh | sh
+# sudo tailscale up --login-server  http://localhost:9809/
+# # 请注意这个密码是随机的
+# sudo headscale nodes register --user mrh --key lHE6IUqDYpwT_bJkkMW9WECq
+# sudo headscale nodes list
+```
+
+
+https://luotianyi.vc/8480.html
+```shell
+dc exec  caddy caddy reload --config /etc/caddy/Caddyfile
+# dc exec headscale headscale apikeys create --expiration 9999d
+# docker exec -it headscale headscale users create mrh
+# 创建可重用秘钥,秘钥不会失效,让用户自行管理
+docker exec -it headscale headscale preauthkeys create --user mrh --reusable --expiration 99999d 
+90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd
+
+# 指定云服务器,注册
+sudo tailscale up --login-server https://hs.magong.site  --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1 --netfilter-mode=off --accept-dns=true
+# 云服务器如果自己配置了内网 DNS 服务器,需要指定该网卡的 search 域名
+sudo resolvectl domain eth0 ~.
+
+# 别的设备注册
+sudo tailscale up --login-server https://hs.magong.site  --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd  --netfilter-mode=off --accept-dns=true --reset
+# sudo tailscale up --login-server http://101.126.130.39:27896 --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd
+
+sudo lsof -i :41641
+docker exec headscale headscale nodes list
+ip route show table 52
+tailscale ping 100.64.0.1
+
+sudo tailscale status
+
+# 下线
+sudo tailscale down
+sudo tailscale up
+sudo tailscale down
+# 删除节点
+docker exec -it headscale headscale nodes delete -i 1
+docker exec -it headscale headscale nodes delete -i 2
+# sudo tailscale up --login-server http://localhost:27896/ --force-reauth
+```
+
+可以修改 ip 地址
+```shell
+sudo sqlite3   /root/program/headscale/headscale/data/db.sqlite
+sudo sqlite3 /home/mrh/program/headscale/headscale/data/db.sqlite
+SELECT id, hostname, ipv4 FROM nodes;
+UPDATE nodes SET ipv4 = "100.64.0.5" WHERE id=1;
+```
+
+
+
+## MagicDNS 冲突的问题
+
+https://sh.alynx.one/posts/Who-Moved-My-DNS-Resolving/
+```shell
+# 建议指定为云服务器的内网 DNS 服务器
+sudo resolvectl domain eth0 ~.
+
+# 下述实测未解决
+sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
+sudo apt-get install network-manager
+systemctl enable NetworkManager
+systemctl restart NetworkManager
+systemctl status NetworkManager
+ping mirrors.ivolces.com
+```