Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-08-2004, 03:35 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2002
Location: Kelowna, BC, Canada
Distribution: RedHat 8.0
Posts: 7
Rep:
|
XP Box won't connect to internet thru RH9 Box (firewall/dhcpd), it can only ping fire
Hello,
I have a dual nic Linux Box (RH9) that I setup (or tried to) to be a firewall/dhcpd server.
Everything seem to start up properly (no error messages)
eth0 = card connected to lan (ip 192.168.0.0) sub 255.255.255.0
eth1 = card connected to internet..
so i only have xp box connected to the lan, i'm trying to get it connected to the net through my firewall, but is doesn't connect.. only connects to the firewall it seems..
Do I absoultely have to setup an iptables/NAT? or that just a popular way of doing things?
-It looks incredibly complicated...
::my dhcpd.conf file::
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
# option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "bc.hsia.telus.net";
option domain-name-servers 209.53.4.130;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.100;
# option netbios-name-servers 192.168.1.100;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.32 192.168.0.99;
default-lease-time 21600;
max-lease-time 46400;
option ip-forwarding on;
# we want the nameserver to appear at a fixed address
# host ns {
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 207.175.42.254;
# }
}
|
|
|
|
07-08-2004, 02:38 PM
|
#2
|
|
Member
Registered: May 2003
Location: Vancouver
Distribution: RH9
Posts: 100
Rep:
|
Well if you can ping your firewall your half way there
1.) yes you have to use nat and iptables, how else can you call it a "firewall"?
2.) NAT stands for Network address translation it routes ip and stuff all over the place
your script for simple stuff is real easy
just copy and paste the stuff below into a file and give it a
chmod +x (filename)
then execute it
#!/bin/sh
# simple firewall made by otis cause this dude needed one
EXTIF = eth1
INTIF = eth0
IPADDR = `ifconfig eth1 | fgrep -i inet | cut -d : -f 2 | cut -d \ -f 1`
IPTABLES = /sbin/iptables
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ip_iptable_nat
modprobe ip_nat_ftp
modprobe ip_nat_irc
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
$IPTABLES -F
$IPTABLES -X
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -t nat -F
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
$IPTALBES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p TCP -m state --state INVALID -j DROP
and thats it! oh btw, its very insecure but it'll route
|
|
|
|
07-09-2004, 12:33 AM
|
#3
|
|
LQ Newbie
Registered: Sep 2003
Distribution: Slackware
Posts: 18
Rep:
|
I tweaked otis's script to give you a little bit of security. I also dropped the modprobe lines in the hope they won't be necessary (I've never needed them, anyway.) Also, iptables's path may differ on your machine so I changed that bit too. And I dropped the IPADDR variable since I didn't see it referenced anywhere else in the script.
This script will allow your internal machine to connect to the outside world, but nothing can connect to it (unless in response to your request of course, hence, ESTABLISHED,RELATED.)
I don't mean to be rude, Otis, I'm just bored right now so I figured I would gild your rose.
#!/bin/sh
# simple firewall made by otis cause this dude needed one
EXTIF=eth1
INTIF=eth0
IPTABLES=`which iptables`
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
$IPTABLES -F
$IPTABLES -X
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP
$IPTABLES -t nat -F
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
$IPTALBES -A INPUT -i $EXTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTALBES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTALBES -A FORWARD -o $EXTIF -i $INTIF -j ACCEPT
|
|
|
|
07-10-2004, 08:09 AM
|
#4
|
|
Member
Registered: Mar 2004
Location: Currently in China
Distribution: Fedora 9
Posts: 130
Rep:
|
Hello,
I also have two computer which are:
first PC ---> win98
2nd PC ---> winXP + RH8.0 (dual boot)
My 2nd pc have 2 NIC and which is respectively connected to the internet and also the first PC for internet connection sharing while i'm using my winXP platform.
Which means, I just know how to make the internet connection sharing through winxp, but not LINUX.
Could somebody pelase show me how to do so? Your suggestion will be much appreciated.
Thankyou~
Adam
|
|
|
|
07-10-2004, 03:02 PM
|
#5
|
|
Member
Registered: May 2003
Location: Vancouver
Distribution: RH9
Posts: 100
Rep:
|
Myboysherman: dude! tweak my script all you want.
I forgot to write the rule to use the IPADDR variable, its a dope rule too!
$IPTABLES -A INPUT -i $EXTIF -s $IPADDR -j DROP
it drops all connections from an external spoofed IP of your own, good rule!
oh and meow man post your question in a new thread man!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:36 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|