0

I tried googling for a while, but I can't put my problem to a good search query so I can't find an answer for what I'm trying to do.

Here we go: I have 3 PCs that I'm trying to connect with my own subnet. One of them is already connected to an outside network and has internet connection. Here's my configuration:

  • PC1: has two NICs,
    • eth0 has the DHCP IP 192.168.0.11, the gateway is 192.168.0.1, and DNS is set automatically to 1.1.1.1, 8.8.8.8, 1.0.0.1, 4.4.4.4. This is the outside network.
    • eth1 has the static IP 192.168.70.1, I set the gateway to 192.168.0.11 (the IP of eth0), I didn't set DNS.
  • PC2: has the static IP 192.168.70.2. Gateway is 192.168.70.1. No DNS.
  • PC3: has the static IP 192.168.70.2. Gateway is 192.168.70.1. No DNS.

Now the two networks work beautifully. I can ssh, ping, and whatever else I need to do except for internet. So my question is the following:

  1. How do I set the gateway on PC1-eth1 so it forwards from the inner network to the outer one? my current solution doesn't work.
  2. How do I set the DNS for PC1-eth1, PC2, and PC3? do I simply set it to 8.8.8.8 and the gateway will handle the DNS requests? Or do I have to setup a DNS server?!

All three machines are using Ubuntu 18.04.

0

After a lot of tiring search. I found this: https://help.ubuntu.com/community/Internet/ConnectionSharing#Ubuntu_Internet_Gateway_Method_.28iptables.29

Which describes how to do this type of forwarding between different networks through two NICs. Exactly what I'm looking for.

|improve this answer|||||

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.