昔は、wifi と eth でブリッジ設定できていたが、 セキュリティの問題より、現在では実施できない。
apt install -y parprouted dhcp-helper bcrelay iproute2
reboot
# eth0はdhcpcdで管理しない. grep '^denyinterfaces eth0' /etc/dhcpcd.conf || echo denyinterfaces eth0 | sudo tee -a /etc/dhcpcd.conf #ip_forwardを有効に sudo sed -i -e 's/^#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf #設定反映 sudo sh -c 'sysctl -p && systemctl daemon-reload && systemctl restart dhcpcd'
reboot
cat << 'EOF' > /home/pi/bridge.sh !#/bin/sh DHCP_SERVER=$(grep -R "offered" /var/log/* 2>/dev/null | tail -n1 | awk '{print $(NF)}') # true ${IP_ADDR_WLAN:=$(/sbin/ip -4 -br addr show wlan0| /bin/grep -Po "\\d+\\.\\d+\\.\\d+\\.\\d+")} true ${INTERFACE_WLAN:=wlan0} true ${INTERFACE_ETH:=eth0} # ip addr flush dev ${INTERFACE_ETH} ip addr add ${IP_ADDR_WLAN}/32 dev ${INTERFACE_ETH} ip link set ${INTERFACE_ETH} up # /sbin/ip link set ${INTERFACE_ETH} promisc on /sbin/ip link set ${INTERFACE_WLAN} promisc on # ip addr add 192.168.99.99 dev eth0 # /usr/sbin/parprouted -d ${INTERFACE_WLAN} ${INTERFACE_ETH} & /usr/sbin/bcrelay -d -i ${INTERFACE_WLAN} -o ${INTERFACE_ETH} /usr/sbin/dhcp-helper -s ${DHCP_SERVER} -b ${INTERFACE_WLAN} EOF #実行属性 chmod a+x /home/pi/bridge.sh
~ <作成したスクリプト> exit 0
reboot