Hola a Todos, tengo un problema medio raro, me pasa en Ubuntu Server y también probe en Debian.
Básicamente lo que tengo es un server casero con dos placas de red y un wifi
eth0 conectada a Internet
eth1 conectada a un switch de 16 bocas
wlan0 se encarga del WIFI con un chip Atheros
el server tiene los siguientes servicios andando correctamente:
BIND9, DHCP3 (isc-dhcp-server), hostapd y otros servicios secundarios que no vienen al caso
Hasta acá todo perfecto todo anda por separado, lo que hice fue crear un bridge entre el eth1 y wlan0 para que eso sea una sola red y se vean entre los diferentes clientes conectados.
El problema surge solo cuando levanto el br0
Lo que puedo hacer:
* el DNS resuelve los IP correctamente (internos y externos)
* puedo conectar varios clientes por WIFI, reciben su IP pueden acceder la LAN pero no a Internet.
* eth0 no tiene acceso a Internet pero si a la LAN (puedo conectarme por SSH a eth0)
ejemplo desde el server:
si apago el br0 todo vuelve a la normalidad (pero pierdo eth1 y wlan0 porque ahora los controlo por br0)Code:poseidon# ping google.com PING google.com (173.194.37.37) 56(84) bytes of data. From 192.168.0.108 icmp_seq=1 Destination Host Unreachable From 192.168.0.108 icmp_seq=2 Destination Host Unreachable ....
Por el lado de BIND y DHCP no veo problemas, los clientes se conectan y obtienen su ip, el DHCP crea el registro en el BIND9, dos ejemplos sacados de la tabla de DNS:
Yo no se si el problema es de route, bridge o hostapd, pero no doy con la tecla.Code:android-cde10a3b388c5d0e A 192.168.16.103 TXT "310950ce2faf4c85aea7b5fdff58ddc382" BLACKBERRY-1A7F A 192.168.16.101 TXT "316833f310fc33955c68ddf12216208135"
Acá dejo mis configs a ver si alguno me tira una idea ya probe de todo.
/etc/interfaces
bridge output (no tengo nada conectado en eth1 en este momento):Code:auto lo eth0 br0 # The loopback network interface iface lo inet loopback # The primary network Interface connected to the Wan allow-hotplug eth0 iface eth0 inet dhcp post-up sh /home/poseidon/router.sh # The second network Interface Connected to the Lan allow-hotplug eth1 iface eth1 inet manual #The Wireless network connecting WIFI clients to the LAN allow-hotplug wlan0 iface wlan0 inet manual # Bridge interface iface br0 inet static address 192.168.16.1 netmask 255.255.255.0 gateway 192.168.16.1 dns-nameservers 192.168.16.1 bridge_ports wlan0 eth1 up /sbin/ifconfig br0 up post-up /bin/sleep 10 ; /usr/sbin/hostapd -B /etc/hostapd/hostapd.conf post-up service isc-dhcp-server restart pre-down /usr/bin/killall hostapd down /sbin/ifdown br0
ifconfig:Code:bridge name bridge id STP enabled interfaces br0 8000.0023cdcb2fea no eth1 wlan0 port no mac addr is local? ageing timer 1 00:23:cd:cb:2f:ea yes 0.00 2 00:30:48:85:0c:dd yes 0.00 1 4c:bc:a5:4e:f6:02 no 1.62 br0 bridge id 8000.0023cdcb2fea designated root 8000.0023cdcb2fea root port 0 path cost 0 max age 20.00 bridge max age 20.00 hello time 2.00 bridge hello time 2.00 forward delay 15.00 bridge forward delay 15.00 ageing time 300.01 hello timer 0.72 tcn timer 0.00 topology change timer 0.00 gc timer 2.72 flags eth1 (2) port id 8002 state disabled designated root 8000.0023cdcb2fea path cost 100 designated bridge 8000.0023cdcb2fea message age timer 0.00 designated port 8002 forward delay timer 0.00 designated cost 0 hold timer 0.00 flags wlan0 (1) port id 8001 state forwarding designated root 8000.0023cdcb2fea path cost 100 designated bridge 8000.0023cdcb2fea message age timer 0.00 designated port 8001 forward delay timer 0.00 designated cost 0 hold timer 0.00 flags
Code:br0 Link encap:Ethernet HWaddr 00:23:cd:cb:2f:ea inet addr:192.168.16.1 Bcast:192.168.16.255 Mask:255.255.255.0 inet6 addr: fe80::223:cdff:fecb:2fea/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:219 errors:0 dropped:0 overruns:0 frame:0 TX packets:1170 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:15206 (14.8 KiB) TX bytes:53353 (52.1 KiB) eth0 Link encap:Ethernet HWaddr 00:30:48:85:0c:dc inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::230:48ff:fe85:cdc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:905 errors:65 dropped:0 overruns:0 frame:0 TX packets:1025 errors:0 dropped:0 overruns:0 carrier:0 collisions:109 txqueuelen:1000 RX bytes:85243 (83.2 KiB) TX bytes:979164 (956.2 KiB) Interrupt:18 eth1 Link encap:Ethernet HWaddr 00:30:48:85:0c:dd UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:19 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:712 errors:0 dropped:0 overruns:0 frame:0 TX packets:712 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:70835 (69.1 KiB) TX bytes:70835 (69.1 KiB) mon.wlan0 Link encap:UNSPEC HWaddr 00-23-CD-CB-2F-EA-00-00-00-00-00-00-00-00-00-00 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:190 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20924 (20.4 KiB) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 00:23:cd:cb:2f:ea inet6 addr: fe80::223:cdff:fecb:2fea/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:234 errors:0 dropped:0 overruns:0 frame:0 TX packets:1216 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20412 (19.9 KiB) TX bytes:79596 (77.7 KiB)Code:route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.16.0 * 255.255.255.0 U 0 0 0 br0 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0 default localhost 0.0.0.0 UG 0 0 0 br0 default localhost 0.0.0.0 UG 0 0 0 eth0las reglas del firewal:Code:dig google.com ; <<>> DiG 9.7.3 <<>> google.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43369 ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 4, ADDITIONAL: 4 ;; QUESTION SECTION: ;google.com. IN A ;; ANSWER SECTION: google.com. 49 IN A 173.194.37.72 google.com. 49 IN A 173.194.37.73 google.com. 49 IN A 173.194.37.78 google.com. 49 IN A 173.194.37.64 google.com. 49 IN A 173.194.37.65 ....bla bla bla (funciona)
Reitero si seteo todo por separado, funciona bien, pero los equipos no se ven entre ellos (wlan0 con los eth1) y quiero que se vean por eso creo el br0.#! /bin/sh
# Firewall rules.
################################
# eth0: connected to WAN #
# br0: connected to LAN #
# eIP: external IP #
################################
IPTABLES=/sbin/iptables
EXTIF="eth0"
INTIF="br0"
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
EXTIP="`/sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
echo " External IP: $EXTIP"
echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
echo " Setting loopback"
$IPTABLES -A OUTPUT -o lo -j ACCEPT
$IPTABLES -A INPUT -i lo -j ACCEPT
echo " Setting INPUT"
### State tracking rules
$IPTABLES -A INPUT -m state --state INVALID -j DROP
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# SSH
$IPTABLES -A INPUT -i $INTIF -p tcp --dport 22 --syn -m state --state NEW -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 8 --rttl --name SSH -j DROP
# Ping
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
echo " Setting FOREWARD"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state NEW -d 192.168.16.100 -j ACCEPT
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
#bridge
$IPTABLES --append FORWARD --in-interface $EXTIF -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p all -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -p all -j ACCEPT
#$IPTABLES -A FORWARD -j LOG
#$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP
echo " Setting SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
echo " Setting OUTPUT"
$IPTABLES -A OUTPUT -m state --state INVALID -j DROP
echo " Enabling Security rules"
#$IPTABLES -A INPUT -o eth0 -p tcp -dport 10000 -j DROP
echo "\nfirewall-iptables done.\n"
lo raro es que puedo hacer un dig pero no un ping :S
saludos
Bookmarks