Ubuntu – Ubuntu server can access internet but cannot ping systems in the LAN

internetlannetworkingpingserver

I have 2 ethernet interface eth0 with IP 192.168.1.11 and eth1 with IP 192.168.1.12 and i have modem/router as 192.168.1.1.

I can access internet from this server machine, but cannot access any other system from this server within the LAN.

Here is the outputs i have.

  knr@kannur:~$ ifconfig -a

    eth0      Link encap:Ethernet  HWaddr 00:27:0e:2f:83:60  
          inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0 
          inet6 addr:   fe80::227:eff:fe2f:8360/64   Scope:Link 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 
          RX packets:13706   errors:0 dropped:0 overruns:0 frame:0 
          TX packets:15389   errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:7203014 (7.2 MB)  TX bytes:2382269 (2.3 MB)

    eth1      Link encap:Ethernet  HWaddr 00:90:27:77:29:ad  
          inet addr:192.168.1.12    Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr:   fe80::290:27ff:fe77:29ad/64 Scope:Link 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 
          RX packets:7797   errors:0 dropped:9 overruns:0 frame:0 
          TX packets:166   errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:609078 (609.0 KB)  TX bytes:25460 (25.4 KB)
knr@kannur:~$ netstat -rn

Kernel IP routing table
Destination       Gateway           Genmask           Flags     MSS   Window    irtt    Iface
0.0.0.0           192.168.1.1       0.0.0.0           UG          0 0            0   eth0
169.254.0.0       0.0.0.0           255.255.0.0       U           0 0            0   eth0
192.168.1.0       0.0.0.0           255.255.255.0     U           0 0            0   eth0
192.168.1.0       0.0.0.0           255.255.255.0     U           0 0            0   eth1
    knr@kannur:~$ route

    Kernel IP routing table
    Destination       Gateway           Genmask           Flags  Metric   Ref      Use   Iface
    default           192.168.1.1     0.0.0.0             UG      0        0        0   eth0
    link-local        *                 255.255.0.0       U       1000     0        0   eth0
    192.168.1.0       *                 255.255.255.0     U       0        0        0   eth0
    192.168.1.0       *                 255.255.255.0     U       0        0        0   eth1

Best Answer

Well, you have two different network interfaces connecting the same subnet (192.168.1.0) used by not directly connected devices (your router on one side and the internal LAN on the other side).

So it is normal that it is not functioning right away.

Eth0 is the first listed interface and the default route for the packet sent by your computer, so all packets sent to any 192.168.1.x address will sent to this interface, so to the router.

The easiest way is to use only one interface of your Linux system, connected to the same hub/switch where the router and the others servers are connected. This way, you can still use 192.168.1.x addresses everywhere. The router must be the default gateway of all servers.

If you really want to keep the things separated (router on one side and servers on the other side, your Linux machine acting as a gateway in-between), you'll have to configure two different subnet.
Let's keep eth0 as it is now (192.168.1.0 with 255.255.255.0 subnet mask).
But you'll have to put the eth1 and all the servers in another subnet, like 192.168.2.0 with subnet mask 255.255.255.0.
If you give 192.168.2.1 as IP address on eth1, this address must be configured as the default gateway of all your internal servers.
Also, you'll have to enable IP forwarding on Linux, which you already done.

Related Question