Linux-Networking

使用 pound 和 dnsmasq 將所有 HTTP 請求重定向到本地網路伺服器作為無線接入點

  • April 24, 2020

我認為可以使用 pound 和 dnsmasq 將所有請求重定向到無線接入點,但我一定犯了一個錯誤。這裡 /etc/dhcpcd.conf

interface wlan0
static ip_address=192.168.42.1/24
static domain_name_servers=191.168.42.1
nohook wpa_supplicant

這裡 /etc/dnsmasq.conf

interface=wlan0      # Use the require wireless interface - usually wlan0
dhcp-range=192.168.42.2,192.168.42.20,255.255.255.0,24h
address=/#/192.168.42.1

這是/etc/pound/pound.cfg

User            "www-data"
Group           "www-data"
#RootJail       "/chroot/pound"

## Logging: (goes to syslog by default)
##      0       no logging
##      1       normal 
##      2       extended
##      3       Apache-style (common log format)
LogLevel        1

## check backend every X secs:
Alive           30

## use hardware-accelleration card supported by openssl(1):
#SSLEngine      "<hw>"

# poundctl control socket
Control "/var/run/pound/poundctl.socket"


######################################################################
## listen, redirect and ... to:

## redirect all requests on port 8080 ("ListenHTTP") to the local webserver (see "Service" below):
ListenHTTP
  Address 192.168.42.1
  Port    80
  Service
    Redirect "http://192.168.42.1:8080/roomtemp.htm"
  End
End

在我的瀏覽器中,我確實可以訪問http://192.168.42.1:8080/roomtemp.htm但如果我寫任何其他內容,則不會顯示任何內容。我的客戶應該得到 192.168.42.1 作為 DNS 伺服器。我究竟做錯了什麼?

我忘了啟用磅,這是在 /etc/default/pound 中完成的

引用自:https://serverfault.com/questions/1013631