Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Routing question for internal network -- help!

Status
Not open for further replies.

jh0

Technical User
Jan 22, 2005
16
US
Hello,

I am running a Fedora 3 box connected directly to a pipe. Off of the box on a second network adapter, I have a small internal network running off of a switch (using the 192.168.10.x IP range).

Everything is working fine so far; I can ping back and forth between the server and the network clients, but the network clients can't access the internet outside of the server.

I've tried running this command to add a gateway:
"route add default gw 111.222.333.1 eth2"
where 111.222.333.1 is my external gateway, and eth2 is my second network adapter. When I try this, I get this message:
"SIOCADDRT: Network is unreachable"

Here is the abbreviated output of "route -n", with Destination, Gateway, Genmask, Flags, and Iface:
111.222.333.0 0.0.0.0 255.255.255.0 U eth1
0.0.0.0 111.222.333.1 0.0.0.0 UG eth1

Kernel packet forwarding is turned on with a line in /etc/sysctl.conf.

The server is able to access the internet with no problem.

Any assistance would be greatly appreciated -- I need to get this setup up and running ASAP. Thank you so much!

Jacob
 
I use the local ip of my router as both gateway and dns server. Your clients will find the dns servers from there.

 
I can't do that in my situation -- here is the network architecture:

WAN -> Server -> Switch -> Clients

The server is connected to the WAN via eth1.
The switch is connected to the server via eth2.
The clients use static IP addresses to connect to eth2 on the server via the switch.

My problem is not with DNS resolution; I've set the network clients to use the WAN DNS addresses and that seems to work fine; the clients just can't access any remote hosts (either by direct IP address or by DNS resolution).

A traceroute from one of the clients shows the packet going to the server's eth2 interface (192.168.10.1) as it should, but it stops there.
 
I seemed to have solved the problem.

Adding two iptables entries fixed it:

iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth2 -j ACCEPT

where eth2 is the internal interface and eth1 is the external interface.

Packet forwarding must be on in /etc/sysctl.conf for it to work.

I hope this is of some use to someone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top