Ethernet Network:
ServerA; IP=192.168.255.254; Mask=255.255.0.0; Bcast=192.168.255.255
|
|
eth1 IP=192.168.1.254; Mask=255.255.0.0; Bcast=192.168.255.255
ServerB DHCP: 192.168.1.1 - 192.168.1.252
eth0 IP=192.168.1.253; Mask 255.255.255.0; Bcast=192.168.1.255
|
|
Client1..252 IP over DHCP (192.168.1.1 - 192.168.1.252)
How can I connect/route to communicate between a ClientX and ServerA?
_
Ping between ClientX and ServerB works.
Ping between ServerA and ServerB works.
_
I tried Routing between two networks on linux? to route between eth0 and eth1 but didn't worked.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.253
netmask 255.255.255.0
broadcast 192.168.1.255
auto eth1
iface eth1 inet static
address 192.168.1.254
netmask 255.255.0.0
broadcast 192.168.255.255
/etc/network/interfaces
interface=eth0
no-dhcp-interface=eth1
dhcp-range=interface:eth0,192.168.1.1,192.168.1.252,1
/etc/dnsmasq.conf
----------------------------------UPDATE 1------------------------------------
ServerA; IP=192.168.255.254; Mask=255.255.255.0; Bcast=192.168.255.255
|
|
eth1 IP=192.168.255.1; Mask=255.255.255.0; Bcast=192.168.255.255
ServerB DHCP: 192.168.1.1 - 192.168.1.253
eth0 IP=192.168.1.254; Mask 255.255.255.0; Bcast=192.168.1.255
|
|
Client1..253 IP over DHCP (192.168.1.1 - 192.168.1.253)
Routing:
sysctl -w net.ipv4.ip_forward=1
iptables -A INPUT -i lo -j ACCEPT # Always accept loopback traffic
iptables -A INPUT -i eth0 -j ACCEPT # We allow traffic from the LAN side
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow established connections
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE # Masquerade
iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT # fowarding
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT # Allow outgoing connections from the LAN side.
Result:
Ping from ClientX to ServerA works, but not from ServerA to ClientX:
$ ping 192.168.1.119
PING 192.168.1.119 (192.168.1.119) 56(84) bytes of data.
From 192.168.255.254 icmp_seq=1 Destination Host Unreachable
From 192.168.255.254 icmp_seq=2 Destination Host Unreachable
…
----------------------------------UPDATE 2 without iptables (Solution)------------------------------------
Network according to UPDATE 1:
ServerA
|
|------------------|------------------|-------------…
eth1 eth1 eth1
ServerB ServerC ServerD
eth0 eth0 eth0
| | |
| | …
ClientX network ClientY network
Routing on ServerA:
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.255.1
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.255.2
…
route add -net 192.168.N.0 netmask 255.255.255.0 gw 192.168.255.N
Forwarting on ServerB:
sysctl -w net.ipv4.ip_forward=1
Ping between all network participant are working without iptables.