Solved

ipv4 forwarding not working?

Posted on 2010-09-03
3
544 Views
Last Modified: 2013-12-16
I have an ubuntu box setup with two nics: eth0 and eth1. Eth0 is a public IP. Eth0 is a private (192.168.0.0/29) 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 207.69.188.185 (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        *               255.255.255.248 U     0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
default         2xx.xxx.xxx.xxx   0.0.0.0         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 207.69.188.185
PING 207.69.188.185 (207.69.188.185) 56(84) bytes of data.

[It does nothing]

Open in new window

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

Open in new window

0
Comment
Question by:DrDamnit
3 Comments
 
LVL 16

Accepted Solution

by:
santoshmotwani earned 500 total points
ID: 33598065
http://ohioloco.ubuntuforums.org/showthread.php?t=604104

Please see Step 5 in this forum , it will solve your problem.
0
 
LVL 10

Expert Comment

by:ampranti
ID: 33610845
/etc/init.d/networking restart
0
 
LVL 32

Author Closing Comment

by:DrDamnit
ID: 33630442
sudo iptables --table nat --append POSTROUTING --jump MASQUERADE --source 192.168.1.0/24

was the part from step 5 that fixed it.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question