LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-05-2003, 11:02 PM   #1
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
ip forwarding/masquerading for dummies?


i'm looking for a quick (and dirty if necessary) way to share a dialup connection between two linux boxes (redhat based) and ame having a hard time finding any information that isn't 10 tons of stuff that has perhapts half a ton of relavant information , basically can anyone condense the information on how to setup the routing necessary to do that? or at the very leats point me to a webpage that has the information plain and simple?
 
Old 06-05-2003, 11:45 PM   #2
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
this post is rated pg 13 for some language content.

this gets asked so much, you could do a search on "internet connection sharing" and get maybe 1000 good results....so this will make 1001

please note this is not secure enough, im just gonna give u the rules
for getting the connection shared. if u want firewall rules (which you DO want)
i suggest doing a serch on this forum on the work "firewall", there are plenty
of good examples (some by me but i think markus has the best one i've seen ) if you do a search on "nailed down markus" i bet you'll find the thread.


1.make sure both computers have NICs (network cards)
2.connect the two computers with a crossover cable (that is important)

network setup:
on box connected to the internet:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0 bcast 192.168.0.255

on other box:

ifconfig eth0 192.168.0.2 netmask 255.255.255.0 bcast 192.168.0.255

you will also have to add the name servers to resolv.conf

here is m y resolv.conf file for an example:

Code:
nameserver 205.152.37.254
nameserver 205.152.144.235
domain bellsouth.net
you may have to do some route add stuff but we'll get to that later i guess.

another way to do all this is open up the network configuation GUIS and put
in the info in the text fields:

computer 1(internet gateway): eth0
ip. 192.168.0.1
mask. 255.255.255.0
gateway/router: 192.168.0.1 (itself)
copmuter 2: eth0
192.168.0.2
mask 255.255.255.0
gateway/router 192.168.0.1 (the above)

if you do it that way using the GUI stuff, the routing tables get set for you and everything.

after you get all taht setup, go to console and type :
eth0 down
eth0 up
on both machines.


iptables rules:


this goes in file...some people put it in rc.firewall, so u can do the same...


#### variables section #####
EXTIF="ppp0"
LANIF="eth0"
CLIENT_IP="192.168.0.2"
SERVER_IP="192.168.0.1"

echo "1" > /proc/sys/net/ipv4/ip_forward ### turns on ip forwarding

### ALLOW EVERYTHING, MAKE THIS ROUTER A BITCH ###
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
###### THIS IS SOO NOT SECURE for POLICY #############


### MASQUERADEing
iptables -A POSTROUTING -t nat -s $CLIENT_IP -j MASQUERADE

######################## EXTRA JUNK BELOW THIS LINE ####################

that might be the only rule you need just to share the internet but again i say THIS IS BY NO MEANS A SECURE SETUP, YOUR MACHINE IS BUCKET NAKED. But you wanted teh quick and dirty.....that's as quick and dirty as i can get without leaving out 2 much info. I left out firewall stuff but i'd go with something more like:


iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP

### now you have a virgin....nothing in nothing out nothing gettin through

### now lets open her up....

iptables -A OUTPUT -m state --state ! INVALID -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED, RELATED

### now we can browse the web!!! whoo whoo!!!!
then u'd have to do some FORWARD rules and if you wanted certain ports open u'd have to add that stuff....but you didnt ask for all that so i'll quit here.

i hope this helps man.

Last edited by Robert0380; 06-05-2003 at 11:46 PM.
 
Old 06-05-2003, 11:49 PM   #3
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
now that i think about it, this is not really a "for dummies"

if u want it to be REAALLY easy, download firestarter or some other front end
GUI app to iptables. it's pretty decent.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux For Dummies AnthonyB Linux - Software 9 11-26-2005 09:03 AM
port forwarding or masquerading? rdrs Linux - Networking 3 08-14-2005 04:42 PM
SUSE Linux 9.3 for Dummies (For Dummies S.) samuelmp SUSE / openSUSE 11 08-01-2005 01:42 PM
IP Forwarding and Masquerading problems drakethegreat Linux - Networking 4 02-22-2005 01:56 AM
C++ For Dummies AFI_Flame Programming 6 10-15-2004 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration