Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23rd December 2003, 09:48 AM
odysseus Offline
Registered User
 
Join Date: Dec 2003
Posts: 17
internet connection sharing - iptables

i have 2 linux boxes, and want both online while one should be the gateway for the other.

this is what i have done ON THE GATEWAY (192.168.0.1):

#enable ip-forwarding
Quote:
echo 1 > /proc/sys/net/ipv4/ip_forward
#masquerade - ppp0 is the device name of my internet connection
Quote:
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
this is what ive done ON THE CLIENT (192.168.0.1)(basically i think all i have to do is set the default rounte):

# file: /etc/sysconfig/network
Quote:
NETWORK=yes
..
..
GATEWAYDEV=eth0
# file: /etc/sysconfig/network-scripts/ifcfg-eth0
Quote:
DEVICE=eth0
IPADDR=192.168.0.2
..
..
GATEWAY=192.168.0.1
after doing so, i still get "destination unreachable" when i try to ping 192.168.0.1 from 192.168.0.2

i also tried
Quote:
/sbin/route add -net default gw 192.168.0.1 netmask 0.0.0.0 metric 1 eth0
,
but still "destination unreachable"


someone can help me ?
Reply With Quote
  #2  
Old 23rd December 2003, 10:03 AM
odysseus Offline
Registered User
 
Join Date: Dec 2003
Posts: 17
this is what i forgot:

Quote:
service network restart
now at least the boxes can ping each other, and the client can also ping to the internet by ip, like ping 217.72.195.42.

but pinging the hostnames, like ping www.web.de fails, because "unknown host www.web.de"

sumthing must be wrong with the dns, here is my /etc/resolv.conf on the Client

localdomain client
nameserver 145.253.2.11
nameserver 145.253.2.75

here is my /etc/resolv.conf on the Sever

localdomain server
nameserver 145.253.2.11
nameserver 145.253.2.75


why the client cannot resolve names ?
Reply With Quote
  #3  
Old 23rd December 2003, 11:03 AM
odysseus Offline
Registered User
 
Join Date: Dec 2003
Posts: 17
if there occur any problems, try to deactivate your firewall to see if its the firewall rules blocking you...

add trusted devices on the servers firewall (eth0, eth1)

im out, it works
Reply With Quote
  #4  
Old 10th January 2004, 05:36 AM
Avatraxiom Offline
Registered User
 
Join Date: Mar 2004
Location: San Jose, CA
Posts: 323
Be aware that when you make a device trusted, you're eliminating all security on that device.

So, don't make your Internet interface trusted. :-)

-M
Reply With Quote
  #5  
Old 10th January 2004, 06:15 PM
steltek Offline
Registered User
 
Join Date: Jan 2004
Posts: 1
Great , simple, and quick howto on setting up NAT/IPTABLES

For your home or other small LAN, here's a URL

http//www.linuxforum.com/linux_tutorials/5/1.php

Great stuff. Had me set up in about 30 seconds.
Reply With Quote
  #6  
Old 10th January 2004, 06:56 PM
pejcao Offline
Registered User
 
Join Date: Jan 2004
Posts: 4
if want to avoid scripts and have NAT running at boot

to allow IP forwarding edit /etc/sysctl.conf change

net.ipv4.ip_forward = 0
to
net.ipv4.ip_forward = 1

To do the NAT stuff run

iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
(change eth0 to the device that connects to internet like ppp0)

then save that rule

service iptables save

BTW If u want to serve DNS also but hate named (BIND), might want to take a look at dnsmasq (http//www.thekelleys.org.uk/dnsmasq/ ). Packaged for FC1 by dag (http//dag.wieers.com/packages/dnsmasq/)
Reply With Quote
Reply

Tags
connection, internet, iptables, sharing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing internet through LAN via iptables gilq1927 Servers & Networking 6 2nd July 2008 01:46 PM
Sharing internet connection abieleck Servers & Networking 21 21st January 2007 02:32 AM
Internet sharing connection glore2002 Servers & Networking 19 10th May 2006 07:54 PM
internet connection sharing stever Servers & Networking 9 19th April 2006 09:53 PM
Internet Connection Sharing backroger Servers & Networking 2 5th March 2005 02:20 PM


Current GMT-time: 11:47 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat