AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-938204

pietrodito's questions

Martin Hope
pietrodito
Asked: 2022-07-09 06:23:53 +0800 CST

无法从我的 Arch 桌面访问特定网站

  • 6

www.balaye.net当互联网的其余部分正常工作时,我无法从我的拱形桌面访问一个特定的网站。

我尝试使用两个不同的 WiFi 网络,但没有成功。此外,我可以从其他运行 Windows 或 android 的设备访问该 url。

这是我的配置,但我不确定我需要提供什么:

文件:/etc/resolv.conf

# Generated by NetworkManager
nameserver 192.168.214.185

使用时nslookup www.balaye.net

Server:         192.168.214.185
Address:        192.168.214.185#53

Non-authoritative answer:
www.balaye.net  canonical name = https://pietrodito.github.io.
Name:   https://pietrodito.github.io
Address: 185.199.111.153
Name:   https://pietrodito.github.io
Address: 185.199.108.153
Name:   https://pietrodito.github.io
Address: 185.199.110.153
Name:   https://pietrodito.github.io
Address: 185.199.109.153
Name:   https://pietrodito.github.io
Address: 2606:50c0:8001::153
Name:   https://pietrodito.github.io
Address: 2606:50c0:8000::153
Name:   https://pietrodito.github.io
Address: 2606:50c0:8003::153
Name:   https://pietrodito.github.io
Address: 2606:50c0:8002::153

使用时dig www.balaye.net

; <<>> DiG 9.18.4 <<>> www.balaye.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29574
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.balaye.net.                        IN      A

;; ANSWER SECTION:
www.balaye.net.         159     IN      CNAME   https://pietrodito.github.io.
https://pietrodito.github.io. 159 IN    A       185.199.110.153
https://pietrodito.github.io. 159 IN    A       185.199.109.153
https://pietrodito.github.io. 159 IN    A       185.199.111.153
https://pietrodito.github.io. 159 IN    A       185.199.108.153

;; Query time: 10 msec
;; SERVER: 192.168.214.185#53(192.168.214.185) (UDP)
;; WHEN: Fri Jul 08 16:19:31 CEST 2022
;; MSG SIZE  rcvd: 138

我也试过这个wget https://www.balaye.net:

--2022-07-08 19:19:53--  https://www.balaye.net/
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving www.balaye.net (www.balaye.net)... failed: Success.
wget: unable to resolve host address ‘www.balaye.net’

当尝试ping www.balaye.net:

ping: www.balaye.net: System error

尝试时ping www.google.com:

ING www.google.com (216.58.214.164) 56(84) bytes of data.
64 bytes from par10s42-in-f4.1e100.net (216.58.214.164): icmp_seq=1 ttl=115 time=53.7 ms
64 bytes from par10s42-in-f4.1e100.net (216.58.214.164): icmp_seq=2 ttl=115 time=47.6 ms
64 bytes from par10s42-in-f4.1e100.net (216.58.214.164): icmp_seq=3 ttl=115 time=58.4 ms
64 bytes from par10s42-in-f4.1e100.net (216.58.214.164): icmp_seq=4 ttl=115 time=60.6 ms
^C
--- www.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 47.585/55.077/60.585/4.986 ms

domain-name-system
  • 1 个回答
  • 21 Views
Martin Hope
pietrodito
Asked: 2019-08-14 07:11:32 +0800 CST

使用 uscoket 库用 sbcl 编写的简单服务器在 AWS 实例上不起作用

  • 5

标题是明确的。

可重现的步骤

* 在 80 端口上使用 HTTP 规则在 AWS 上启动一个 Ubuntu 实例

* 安装 sbcl

sudo apt install sbcl -y

* 为 root 安装 usocket 库

请参阅下一步以了解我为什么以 root 身份执行此操作

curl -O https://beta.quicklisp.org/quicklisp.lisp
sudo sbcl --load quicklisp.lisp

下一行需要输入 sbcl REPL

(quicklisp-quickstart:install)
(ql:add-to-init-file)
(ql:quickload "usocket")

* 使用 Land of Lisp 示例 ( http://landoflisp.com/ )

在一个名为server.lisp

(require 'usocket)

(defun http-char (c1 c2 &optional (default #\Space))
  (let ((code (parse-integer
               (coerce (list c1 c2) 'string)
               :radix 16
               :junk-allowed t)))
    (if code
        (code-char code)
        default)))

(defun decode-param (s)
  (labels ((f (lst)
             (when lst
               (case (car lst)
                 (#\% (cons (http-char (cadr lst) (caddr lst))
                            (f (cdddr lst))))
                 (#\+ (cons #\space (f (cdr lst))))
                 (otherwise (cons (car lst) (f (cdr lst))))))))
    (coerce (f (coerce s 'list)) 'string)))

(defun parse-params (s)
  (let* ((i1 (position #\= s))
         (i2 (position #\& s)))
    (cond (i1 (cons (cons (intern (string-upcase (subseq s 0 i1)))
                          (decode-param (subseq s (1+ i1) i2)))
                    (and i2 (parse-params (subseq s (1+ i2))))))
          ((equal s "") nil)
          (t s))))

(defun parse-url (s)
  (let* ((url (subseq s
                      (+ 2 (position #\space s))
                      (position #\space s :from-end t)))
         (x (position #\? url)))
    (if x
        (cons (subseq url 0 x) (parse-params (subseq url (1+ x))))
        (cons url '()))))


(defun get-header (stream)
  (let* ((s (read-line stream))
         (h (let ((i (position #\: s)))
              (when i
                (cons (intern (string-upcase (subseq s 0 i)))
                      (subseq s (+ i 2)))))))
    (when h
      (cons h (get-header stream)))))

(defun get-content-params (stream header)
  (let ((length (cdr (assoc 'content-length header))))
    (when length
      (let ((content (make-string (parse-integer length))))
        (read-sequence content stream)
        (parse-params content)))))

(defun serve (request-handler)
  (let ((socket (usocket:socket-listen #(127 0 0 1) 80)))
    (unwind-protect
         (loop (with-open-stream (stream (usocket:socket-stream
                                          (usocket:socket-accept socket)))
                 (let* ((url    (parse-url (read-line stream)))
                        (path   (car url))
                        (header (get-header stream))
                        (params (append (cdr url)
                                        (get-content-params stream header)))
                        (*standard-output* stream))
                   (funcall request-handler path header params))))
      (usocket:socket-close socket))))

(defun hello-request-handler (path header params)
  (if (equal path "greeting")
      (let ((name (assoc 'name params)))
        (if (not name)
            (princ "<html><form>What is your name?<input name='name'/></form></html>")
            (format t "<html>Nice to meet you, ~a!</html>" (cdr name))))
      (princ "Sorry... I don't know that page")))

(serve #'hello-request-handler)

然后以 root 身份启动服务器:

sudo sbcl --load "server.lisp"

我正在使用 root,因为我无法摆脱普通用户的以下错误消息

The condition Socket error in "bind": 13 (Permission denied) occurred with errno :0.

然后一切似乎都是正确的,但我无法使用以下标准浏览器访问服务器:

http://IPv4.Public.IP:80

* 补充诊断:

AWS 安全组/入站规则

╔══════╦══════════╦════════════╦═══════════╗
║ Type ║ Protocol ║ Port Range ║  Source   ║
╠══════╬══════════╬════════════╬═══════════╣
║ HTTP ║ TCP      ║         80 ║ 0.0.0.0/0 ║
║ HTTP ║ TCP      ║         80 ║ ::/0      ║
║ SSH  ║ TCP      ║         22 ║ 0.0.0.0/0 ║
╚══════╩══════════╩════════════╩═══════════╝

iptables

sudo iptables -L -v
Chain INPUT (policy ACCEPT 346 packets, 23760 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 244 packets, 32428 bytes)
 pkts bytes target     prot opt in     out     source               destination
sudo iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

在服务器上卷曲

curl 127.0.0.1
Sorry... I don't know that page

不出所料!

从远程机器 ping

需要将自定义 ICMP 规则添加到入站安全组策略(现在我知道ping正在使用 ICMP ...)

ping 35.180.138.87
64 bytes from 35.180.138.87: icmp_seq=1 ttl=49 time=173 ms
64 bytes from 35.180.138.87: icmp_seq=2 ttl=49 time=32.2 ms
^C
--- 35.180.138.87 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1005ms
rtt min/avg/max/mdev = 32.248/102.884/173.520/70.636 ms

从远处的机器卷曲

curl 35.180.138.87
curl: (7) Failed to connect to 35.180.138.87 port 80: Connection refused

网络统计

netstat -nlp
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      -

带有端口 80 的这一行仅在我的服务器运行时出现。

http amazon-web-services
  • 2 个回答
  • 130 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve