Click to See Complete Forum and Search --> : How do I setup a Router AND Firewall with RH8


Enigmatix
02-17-2003, 09:02 AM
Hi

Please I wonder if you can help.

I have an NTL cable modem and I want this to attach to my Linux Box (redhat 8 on minimum install option) and I want the linux box to be a router and a firewall. From this i want to connect my hub and about 4 other machines to that hub

Can you tell me how to setup the router/firewall or point me towards documentation please.

cojo
02-17-2003, 12:49 PM
Enigmatix, I just got mine setup yesterday. Is any of your other machines are windoze??? If so, you will also need to setup Samba. This is what I have setup on my RH8 server at home so far:

samba, dhcp server, router and Firewall....

Router and Firewall are pain in the a#$ to setup at first. If you like I could send you a copy of my script from my machine tonight. But, if you want to learn it yourself. Go to this link:

http://www.google.com/linux?hl=en&lr=&ie=ISO-8859-1&q=iptables

kjkrum
02-17-2003, 11:20 PM
First of all, you need two NICs in your machine. Designate one the external interface and one the internal/lan interface. Set up $EXT for dhcp and $LAN for a fixed address, say 192.168.1.1/24.

# install modules
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# and if you use irc...
modprobe ip_conntrack_irc

# set kernel parameters
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_dynaddr
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter

# allow machines on $LAN to connect to $EXT
iptables -A FORWARD -i $LAN -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQERADE

Ideally you'll want much more restrictive firewall rules than this. Instead of just forwarding anything from the $LAN interface, for example, you could be selective about what protocols or what destinations are allowed. And you'll definitely want to block all incoming traffic on the FORWARD and INPUT chains. Firewalls are a topic all their own...

You'll probably want to set up a DHCP server on the $LAN interface (and ONLY on the $LAN interface!) If you don't want to run your own DNS server, set up DHCP to configure your other machines with your ISP's DNS servers.

Enigmatix
02-18-2003, 05:39 AM
COjo - From the site which one of the links do i click on. im surprised there are no howtos on routers.

The other guy.. thanks for trying to break it down but i dont know what your talking about.. im totally new to linux and have been using it bit by bit etc..i dont understand ur $LAN stuff etc thats why i would rather try and learn myself. im using building a router as another learning project about networking and linux.

Enigmatix
02-18-2003, 05:48 AM
kjkrum what type of ip is this? 192.168.1.1/24.
Whats the /24? i never seen it this way before. Furthermore what IP addresses can i use for my internal network? Can i just pick any old numbers from 1.1.1.1 to 255.255.255.255 or does it have to be a specific class...

Im that new i would even need to know how to set up one card for ext and one for lan. Thats why i would prefer to read some documentation

DMR
02-18-2003, 01:25 PM
The /24 indicated a subnet mask of 255.255.255.0. Specifically, the 24 indicates that the netmask has 24 bits (out of a possible 32) set to 1.
A netmask of 255.255.0.0 can be indicated by /16, and a netmask of 255.0.0.0 can be indicated as /8.

As far as the IP addresses you choose, they should be within the non-routable range for whatever address class (A, B, or C) you are going to use, and should not conflict with any reserved addresses such as the broadcast address.

An intro to IP addressing is here (http://www.thelinuxreview.com/howto/intro_to_networking/c7410.htm); you should give it read to familiarize yourself with the basics.

There's also a wealth of related information in the networking category (http://www.tldp.org/HOWTO/HOWTO-INDEX/networking.html) at The Linux Documentation Project.

:)

kjkrum
02-19-2003, 04:20 PM
Originally posted by Enigmatix
kjkrum what type of ip is this? 192.168.1.1/24.
Whats the /24?

It's called CIDR notation. Check out http://arizona.edu/netmgrs/subnetting.html for a really good explanation.

cojo
02-19-2003, 04:42 PM
Egnima,

any of the link will do the job. But, this link is collection of all other links.

http://www.linuxguruz.org/iptables/

Here is another good link

http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworkGateway.html

You need to kinda understand iptables to set your RH8 machine up as a router and firewall. Go through the two links above and it will give you a general idea what you need to do. If you still need more help. Let me know.