BandaAncha.eu

  • 🔍 en 📰 artículos ⏎
  • 🔍 en 💬 foros ⏎
  • 🔍 en 👇 este 💬 foro ⏎
  • 🔍 en 👇 este 💬 tema ⏎
Regístrate Regístrate Identifícate Identifícate

Uniendo redes

BocaDePez
BocaDePez

Hola! Estoy intentado unir dos redes mediante un debian, pero no acabo de conseguirlo. El esquema es el siguiente...

Red A - 192.168.1.X

Red B - 192.168.0.X

Adicionalmente, mi equipo tiene la ip 192.168.0.5 y el router de internet es 192.168.1.1

La configuración del debian es la siguiente...

root@hades:~# cat /etc/network/interfaces# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth1iface eth1 inet staticaddress 192.168.1.4netmask 255.255.255.0# The primary network interfaceauto eth0iface eth0 inet staticaddress 192.168.0.1netmask 255.255.255.0
root@hades:~# cat /proc/sys/net/ipv4/ip_forward1

Con esta configuración he intentado realizar un ping al router desde mi maquina y no llega :( ¿que puede estar pasando? ¿como se podría solucionar?

El siguiente paso será añadir el ruteo para la salida a internet...

route add default gateway 192.168.1.1

Sería correcto? Se podría meter esta linea en /etc/network/interfaces?

BocaDePez
BocaDePez

Pongo la configuración de nuevo que parece q no se ve muy bien...

root@hades:~# cat /etc/network/interfaces# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth1iface eth1 inet staticaddress 192.168.1.4netmask 255.255.255.0# The primary network interfaceauto eth0iface eth0 inet staticaddress 192.168.0.1netmask 255.255.255.0root@hades:~# cat /proc/sys/net/ipv4/ip_forward1
🗨️ 1
BocaDePez
BocaDePez

root@hades:~# cat /etc/network/interfaces

# 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

# The primary network interface

auto eth1

iface eth1 inet static

address 192.168.1.4

netmask 255.255.255.0

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.0.1

netmask 255.255.255.0

root@hades:~# cat /proc/sys/net/ipv4/ip_forward

1

txuspe

Sí, en la sección de eth1 añade la línea:

gateway 192.168.1.1

Con eso debería bastar.

🗨️ 1
BocaDePez
BocaDePez

cuando pongo esta linea, me da un error....

Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).Reconfiguring network interfaces...SIOCDELRT: No such processdone.
superllo

Vale no, edito, no me había enterado.

BocaDePez
BocaDePez

No llegas al router desde la 0.5 porque tu router no tiene rutas de vuelta para esa red.

O haces un NAT en el debian, o planteas la topología de la red de otra manera. ¿Nos explicas con un poco más de detalle lo que quieres hacer?

🗨️ 3
BocaDePez
BocaDePez

Simplemente quería instalar un servidor proxy para monitorizar la conexión a internet. He instalado el squid, pero como no me funciona, pues estoy haciendolo por partes. Para comenzar simplemente quería que hiciera un ping al router, para ya despues meterme con el squid y el iptables...

Miraré lo del NAT a ver como va, a ver si saco algo... ¿algun consejo?

🗨️ 2
BocaDePez
BocaDePez

Lo del proxy te funcionará sin necesidad de NAT.

Si quieres hacer ping desde la 0.5 a la 1.1, necesitas decirle que la ruta para ir a 192.168.0.0/24 es la 192.168.1.4. Probablemente con un router adsl doméstico normal y corriente, no puedas hacer esto.

La otra opción es hacer NAT. En el debian, como root, aparte de activar el forwarding como te han explicado arriba, has de hacer:

iptables -t nat -I POSTROUTING -o eth1 -j MASQUERADE

A partir de entonces ya te funcionará el ping, y probablemente hasta puedas navegar desde la red 0.5

🗨️ 1
BocaDePez
BocaDePez

correcto! ya puedo navegar y utilizar el squid :D

Gracias por la ayuda