Tengo una Macbook Professional más antigua por ahí, así que pensé que podría convertirla en un servidor doméstico de bricolaje. Estoy luchando por conseguir guardacables ejecutándose en él como servidor. El problema es que el clásico puede tener éxito en el protocolo de enlace pero no hay acceso a Web en el par que se conecta al servidor.
Mis archivos de configuración se comparten a continuación, mi objetivo es enrutar todo el tráfico de mis pares al en0
interfaz en mi servidor. Intenté jugar con el DNS y vi que mi resolv.conf está correctamente poblado.
❯ ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
choices=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether 12:7d:26:80:dd:ee
inet 192.168.1.170 netmask 0xffffff00 broadcast 192.168.1.255
media: autoselect
standing: energetic
❯ cat /usr/native/and so forth/wireguard/postup.sh
#!/bin/sh
# 1) This ensures our friends proceed to report their Wireguard
# assigned IPs whereas linked to the VPN. That is required
# for his or her site visitors to get routed appropriately by the firewall
# guidelines we crafted earlier with pf.
/usr/sbin/sysctl -w internet.inet.ip.forwarding=1
# 2) Making ready the listing the place we'll persist the pf tokens
# generated by Step (3) & (4). That token can then be utilized by
# our postdown.sh script to take away the routing guidelines when
# Wireguard is shut down.
mkdir -p /usr/native/var/run/wireguard
chmod 700 /usr/native/var/run/wireguard
# 3) Dynamically add the IPv4 NAT rule, allow the firewall,
# improve its reference rely (-E), and persist the reference
# token generated by the command into
# pf_wireguard_token_ipv4_token.txt, which postdown.sh will
# reference when Wireguard is shut down.
echo 'nat on en0 from 10.0.10.1/24 to any -> (en0)' |
pfctl -a com.apple/wireguard_ipv4 -Ef - 2>&1 |
grep 'Token' |
sed 'spercentToken : (.*)%1%' > /usr/native/var/run/wireguard/pf_wireguard_ipv4_token.txt
IPV4_TOKEN=`sudo cat /usr/native/var/run/wireguard/pf_wireguard_ipv4_token.txt`
echo "Added PF IPv4 NAT site visitors routing rule with token: ${IPV4_TOKEN}"
❯ cat /usr/native/and so forth/wireguard/coordinates.conf
[Interface]
Tackle = 10.0.10.1/24
ListenPort = 61820
PrivateKey = <redacted>
SaveConfig = false
MTU = 1280
#DNS = 1.1.1.1
PostUp = /usr/native/and so forth/wireguard/postup.sh
PostDown = /usr/native/and so forth/wireguard/postdown.sh
# 11: 11 > wgclient_11.conf
[Peer]
PublicKey = <redacted>
PresharedKey = <redacted>
AllowedIPs = 10.0.10.2
La salida del wg
El comando está aquí, solo se intercambian unos pocos bytes de datos y no hay acceso a Web en el par una vez que se conecta al servidor.
❯ sudo wg
interface: utun4
public key: <>
non-public key: (hidden)
listening port: 61820
peer: <>
preshared key: (hidden)
endpoint: 192.168.1.254:45341
allowed ips: 10.0.10.2/32
newest handshake: 8 seconds in the past
switch: 41.92 KiB acquired, 912 B despatched
❯ ifconfig utun4
utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
inet 10.0.10.1 --> 10.0.10.1 netmask 0xffffff00
❯ sudo /usr/sbin/networksetup -setdnsservers Wi-Fi 1.1.1.1
❯ cat /and so forth/resolv.conf
#
# macOS Discover
#
# This file will not be consulted for DNS hostname decision, deal with
# decision, or the DNS question routing mechanism utilized by most
# processes on this technique.
#
# To view the DNS configuration utilized by this technique, use:
# scutil --dns
#
# SEE ALSO
# dns-sd(1), scutil(8)
#
# This file is routinely generated.
#
search lan
nameserver 1.1.1.1
-- I am ready to hook up with the web from the server, with a SSH session
❯ ping google.com
PING google.com (142.250.217.110): 56 knowledge bytes
64 bytes from 142.250.217.110: icmp_seq=0 ttl=119 time=14.757 ms
64 bytes from 142.250.217.110: icmp_seq=1 ttl=119 time=14.312 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets acquired, 0.0% packet loss
round-trip min/avg/max/stddev = 14.312/14.534/14.757/0.223 ms
No estoy del todo seguro de qué estoy haciendo mal, agradecería cualquier sugerencia aquí. Parece que hay algún problema con la configuración de mi firewall, pero no estoy muy familiarizado con la configuración en una Mac.
También intenté usar un contenedor Docker para configurar Wireguard y tuve exactamente el mismo problema y luego pasé al steel desnudo.