0

I have an ubuntu server running 16.04

There are 2 NIC cards:

One is 192.168.10.9/24, this has internet access through the gateway of 192.168.10.254.

My second Nic card had an IP of 192.168.25.1/24 and currently does not have a gateway or internet access.

Everything on the 192.168.25.x network is using DHCPD from the ubuntu server.

How do I allow internet access to the 192.168.25.x?

  • Are you trying to use your computer as a router for the second network, or are you trying to use two separate networks for the one computer to access (like a dual homed server?) – ben-Nabiy Derush May 26 '17 at 21:19
2

You need to enable IPv4 Forwarding. There is an excellent write up on the subject here.

The following will help you check the system state and set the parameter from the command line. Please note, this setting will be ephemeral; you will need to determine how to make the setting permanent (if you so wish) based upon your specific distribution and version.

The following is taken from this article:


Check if IP Forwarding is enabled

We have to query the sysctl kernel value net.ipv4.ip_forward to see if forwarding is enabled or not:

Using sysctl:

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

or just checking out the value in the /proc system:

cat /proc/sys/net/ipv4/ip_forward
0

As we can see in both the above examples this was disabled (as show by the value 0).

Enable IP Forwarding on the fly

As with any sysctl kernel parameters we can change the value of net.ipv4.ip_forward on the fly (without rebooting the system):

sysctl -w net.ipv4.ip_forward=1

or

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

the setting is changed instantly; the result will not be preserved after rebooting the system.

  • I followed your instructions, they changed the output of cat /proc/sys/net/ipv4/ip_forward from 0 to 1 I am still unable to ping -I em2 www.google.com Below is my interfaces, are they correct? Em1 has internet and on our main network. Em2 is for security cameras. The loopback network interface auto lo iface lo inet loopback # The primary network interface auto em1 iface em1 inet static address 192.168.10.9 netmask 255.255.255.0 gateway 192.168.10.254 auto em2 iface em2 inet static address 192.168.25.1 netmask 255.255.255.0 gateway 192.168.10.254 – Matthew Economy Jun 2 '17 at 13:48
  • Also, I cannot figure out how to add spaces between my paragraphs, sorry for the block text. – Matthew Economy Jun 2 '17 at 13:53
  • You may have to restart the network "service", not certain. Sorry for delay, I was on holiday and didn't see any of this. – 0xSheepdog Jun 12 '17 at 20:25

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.