Kommunikation zwischen zwei Subnetzen

Kommunikation zwischen zwei Subnetzen

Ich habe ein einfaches Netzwerk, das unten beschrieben wird:

Server1 (Two NICs):  
eth0: xxx.xxx.xxx.xxx Public IP address connected to ISP device  
eth1: 192.168.0.1 LAN1(192.168.0.0)

Server2 (Two NICs):  
eth0: 192.168.0.3   
eth2: 192.168.1.1 LAN2(192.168.1.0)

Ich möchte, dass Maschinen aus LAN1 mit Maschinen aus LAN2 kommunizieren.

Meine Linux-Kenntnisse sind eher dürftig, daher hoffe ich, dass mir hierbei jemand helfen kann.

Nachfolgend habe ich die Ausgabe vonIP-AdresseUndIP-Routevon beiden Servern
Server 1
IP-Adresse

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether d4:ae:52:cc:13:69 brd ff:ff:ff:ff:ff:ff
    inet xx.xx.xx.xxx/30 brd xx.xx.xx.xxx scope global eth0
    inet6 fe80::d6ae:52ff:fecc:1369/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether d4:ae:52:cc:13:6a brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global eth1
    inet6 fe80::d6ae:52ff:fecc:136a/64 scope link
       valid_lft forever preferred_lft forever

IP-Route

default via xxx.xxx.xxx.xxx dev eth0  metric 100
yyy.yyy.yyy.yyy/30 dev eth0  proto kernel  scope link  src zzz.zzz.zzz.zzz
192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.1
192.168.1.0/24 via 192.168.0.3 dev eth1

wobei:
xxx.xxx.xxx.xxx mein ISP-Gateway ist
yyy.yyy.yyy.yyy/30 mein Subnetz ist
zzz.zzz.zzz.zzz meine öffentliche IP-Adresse ist (aber das spielt in diesem Fall keine Rolle)

Server2
IP-Adresse

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:23:54:c0:43:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.3/24 brd 192.168.0.255 scope global eth0
    inet6 fe80::223:54ff:fec0:439e/64 scope link
       valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether ec:08:6b:06:3f:dd brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global eth2
    inet6 fe80::ee08:6bff:fe06:3fdd/64 scope link
       valid_lft forever preferred_lft forever

IP-Route

192.168.1.0/24 dev eth2  proto kernel  scope link  src 192.168.1.1
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.3
default via 192.168.0.1 dev eth0  metric 100

BEARBEITEN: Ich habe die Ausgabe des tracerouteBefehls vonServer 1. Vielleicht hilft es:
traceroute to 192.168.1.14 (192.168.1.14), 30 hops max, 60 byte packets 1 192.168.0.3 (192.168.0.3) 0.102 ms 0.092 ms 0.084 ms 2 * * * 3 * * * 4 * * * 5 * * * 6 * * * 7 *^C

Die Topologie des Netzwerks sieht wie folgt aus:Das.

Antwort1

DerStichwortIstip-forwarding

Um die IPv4-Weiterleitung auf Server2 zu aktivieren (ich denke, das ist es, was Sie tun möchten), prüfen Sie zunächst, ob sie aktiviert ist:

sysctl net.ipv4.ip_forward

Wenn es den Wert hat, 0ist es deaktiviert (Standard).

echo 1 > /proc/sys/net/ipv4/ip_forward

Aktiviert es, aber nur für Ihre aktuelle Sitzung (bis zum Neustart).

Wenn Sie diese Konfiguration dauerhaft machen möchten, verwenden Sie am besten die Datei, /etc/sysctl.confin der Sie eine Zeile mit dem Inhalt hinzufügen können:

net.ipv4.ip_forward = 1

Um die Änderungen in dieser Datei zu aktivieren, verwenden Sie:

sysctl -p /etc/sysctl.conf

Bevor Sie Befehle einfach kopieren, versuchen Sie bitte, sie zu verstehen

verwandte Informationen