I have a server with two network cards:

  • eth0 -> public static ip
  • eth1 -> local network dhcp

Both cards are connected to the same modem.

If I enable only eth0, I can access from local network (and from internet) using its subdomain or public ip.

If I connect also eth1, I can access from local network only using internal ip, and from internet (obviusly) using only public ip / subdomain.

How can I access this machine from public ip also from other machines on local network with eth1 enabled?

Edit: I have no gateway on second interface, and ip_forward is already enabled.

Here the config:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address x.x.x.x
gateway x.x.x.y

auto eth1
iface eth1 inet dhcp

  • Possible duplicate of Routing doesn't working in linux – kubanczyk Apr 10 at 20:46
  • I added some extra infos. It doesn't seem the same problem. – user1365836 Apr 11 at 10:38
  • It's not clear what your goal is. Do you want local and Internet users to reach via public IP? – Ron Trunk Apr 11 at 12:49
  • If i ping public ip set on eth0, it doesn't work (from local network, it works from outside). If I disable eth1 I can ping it. Of course I want to reach public ip from local network too. – user1365836 Apr 11 at 13:04
  • Can you edit your question to include a diagram of your network? There may be other ways of solving this problem. – Ron Trunk Apr 11 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.