Solved

ipv4 forwarding not working?

Posted on 2010-09-03
3
542 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now