LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-26-2003, 07:50 AM   #1
KiLLaWaBBiT
Member
 
Registered: Mar 2003
Location: UK
Distribution: Slackware 10.2, Kernel 2.6.13
Posts: 69

Rep: Reputation: 15
Question Newbie wishing to share net connection, help! :D


Hey, i'm running red-hat 8.0, and trying to share my net connection with an XP machine. The setup goes like this. Broadband connection into my eth0, and lan connection to the XP machine on my eth1. I've turned on ipv4 forwarding (i think), and pointed the XP machine's gateway/dns lookups at my red-hat machine. I have no clue where to go from here, any help would be greatly appreciated.
 
Old 03-26-2003, 08:55 AM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Your going to need to setup ip masquerading. There are some how-tos here:
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO
http://www.netfilter.org

But your going to need to add a couple of lines to iptables.
In the nat table add:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

In the filter add:
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

Make sure to set the default policies for the postrouting and forward chains like:
iptables -P FORWARD DROP
iptables -P POSTROUTING DROP

Take a look at the howtos and then work these rules into your existing firewall script.
HTH

Last edited by Capt_Caveman; 03-26-2003 at 08:58 AM.
 
Old 03-26-2003, 09:25 AM   #3
KiLLaWaBBiT
Member
 
Registered: Mar 2003
Location: UK
Distribution: Slackware 10.2, Kernel 2.6.13
Posts: 69

Original Poster
Rep: Reputation: 15
Smile Many thanks

Thanks a lot CC, i'll have a good read through the how-to's and let you know how it goes.
 
Old 03-26-2003, 10:45 AM   #4
KiLLaWaBBiT
Member
 
Registered: Mar 2003
Location: UK
Distribution: Slackware 10.2, Kernel 2.6.13
Posts: 69

Original Poster
Rep: Reputation: 15
Talking Woo Hoo!!

She's working like a beaut!
Much appreciated sir!
 
Old 03-26-2003, 12:15 PM   #5
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Arctic
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820

Rep: Reputation: 46
I gotta give kudo's to Capt. Caveman on this one. That was the most comprehensive iptables answer I have ever seen posted. Well done..
 
Old 03-26-2003, 04:06 PM   #6
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
I would bow or something, but I just spent the last 2 hours trying to fix my own firewall after I screwed with it to come up with that answer...doh! Nothing better than iptables to teach some humility.
 
Old 03-26-2003, 07:19 PM   #7
kublador
Member
 
Registered: Aug 2002
Location: Philippines
Distribution: Slackware, CentOS, Ubuntu
Posts: 325

Rep: Reputation: 30
" But your going to need to add a couple of lines to iptables.
In the nat table add:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE "

hmmmm how can i add these line to the iptables? what is the location of the file that im gonna edit?
thank you
 
Old 03-26-2003, 09:43 PM   #8
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
There are a couple of ways to do it. First you can just type each rule in from the command line one after another keeping in mind that your adding them to the bottom of the chain (-A means append). Then once your done do:

service iptables restart

Or you can put all these together in a firewall script. Just make a normal text file with your favorite text editor and save it as whatever name you like. Then have it run at startup, usually by adding an entry in /etc/rc.d/rc.local that points to the path of the script. Just make sure that the script is executable using the chmod command.

Probably a good idea to look at the howto's first to get an idea of what your doing and to get some other rules that you'll need for packet filtering. Whatever you do (and I stress whatever!) don't edit the actual iptables file in /etc/sysconfig/iptables. Bad things happen when you do this (see my previous post above).
HTH

Last edited by Capt_Caveman; 03-26-2003 at 09:44 PM.
 
  


Reply



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
net connection themanwhowas Linux - Newbie 3 11-24-2005 03:29 PM
9.2 Net Install from SMB Share Question dbnettle SUSE / openSUSE 2 02-23-2005 02:19 PM
no connection to net Lostin Linux 99 Linux - Newbie 3 11-05-2004 05:22 PM
net connection kinshuk_sahaya Linux - Newbie 1 08-22-2003 12:48 AM
idea: sharing net connection, method: iptables..., problem: broken net connection :( danny2055 Linux - Networking 4 06-09-2003 07:00 AM

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

All times are GMT -5. The time now is 03:56 PM.

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