라우팅을 위한 Dnsmasq 및 Iptables

라우팅을 위한 Dnsmasq 및 Iptables

저는 두 개의 이더넷 포트가 있는 Raspberry Pi를 라우터로 사용하고 있습니다. 네트워크는 다음과 같습니다.

"Internet" <--(…)--> Fritz!Box <--(172.16.x.y)--> [eth1, dhcp] Raspberry Pi [eth0, static] <--(192.168.178.z)--> "Switches, PCs, etc."

라즈베리파이는 라즈비안을 실행하고 있습니다. 인터넷 연결, 업데이트, 소프트웨어 설치 등을 할 수 있습니다.

rc.local은 다음과 같습니다

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
#
# iptables-Regeln zum Routing von eth0 auf eth1
lan_if=eth0
wan_if=eth1
# Loopback-Traffic sollte aktiv sein.
iptables -A INPUT -i lo -j ACCEPT
# Traffic von LAN-Seite aus aktzeptieren
iptables -A INPUT -i $lan_if -j ACCEPT
###################################
# ROUTING #########################
###################################
# eth1 ist das WAN
# eth0 ist das LAN
# Aufgebaute Verbindungen zulassen
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Was ist "Masquerade"
iptables -t nat -A POSTROUTING -o $wan_if -j MASQUERADE
# Weiterleitung
iptables -A FORWARD -i $wan_if -o $lan_if -m state --state RELATED,ESTABLISHED -j ACCEPT
# Ausgehende Verbindungen von der LAN-Seite zulassen
iptables -A FORWARD -i $lan_if -o $wan_if -j ACCEPT
#
exit 0

dnsmasq.conf:

interface=eth0
dhcp-range=192.168.178.2,192.168.178.254,12h
dhcp-host=28.D2.44.5B.99.A9,permutare,192.168.178.55,12h
dhcp-option=3,192.168.178.1

인터페이스:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# WAN
auto eth1
  iface eth1 inet dhcp
#  address 172.16.0.2
#  netmask 255.255.0.0
#  gateway 172.16.0.1
#  dns-nameservers 172.16.0.1

# LAN
auto eth0
  iface eth0 inet static
  address 192.168.178.1

"resolvconf"가 설치되지 않았습니다.

"192.168.178.z" 네트워크의 컴퓨터는 인터넷이나 "172.16.xy" 네트워크의 컴퓨터에 액세스할 수 없습니다. 하지만 이전에 핑한 적이 없는 웹사이트의 IP 주소를 확인할 수 있습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

미리 감사드립니다.

마커스

관련 정보