• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

ipv4 forwarding not working?

I have an ubuntu box setup with two nics: eth0 and eth1. Eth0 is a public IP. Eth0 is a private ( network. Eth0 has dhcp on it, and distributes addresses just fine. Clients can ping the box from that network.

Clients cannot, however, ping public IP addresses like (Earthlink DNS Servers).

I think I do not have ipv4 forwarding setup properly even though it is set to "1".

What's the problem?
michael@box:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
localnet        *      U     0      0        0 eth0     *        U     0      0        0 eth1
default         2xx.xxx.xxx.xxx         UG    100    0        0 eth0

Open in new window

michael@box:~$ sudo sysctl -p
net.ipv4.ip_forward = 1

Open in new window

root@clientbox:/home/fakeuser# ping
PING ( 56(84) bytes of data.

[It does nothing]

Open in new window

root@clientbox:/home/fakeuser# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=1.38 ms
64 bytes from icmp_seq=2 ttl=64 time=1.35 ms
64 bytes from icmp_seq=3 ttl=64 time=1.35 ms
64 bytes from icmp_seq=4 ttl=64 time=1.34 ms
64 bytes from icmp_seq=5 ttl=64 time=0.185 ms
--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms

Open in new window

1 Solution

Please see Step 5 in this forum , it will solve your problem.
/etc/init.d/networking restart
DrDamnitAuthor Commented:
sudo iptables --table nat --append POSTROUTING --jump MASQUERADE --source

was the part from step 5 that fixed it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now