LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-24-2004, 05:39 PM   #1
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Rep: Reputation: 30
creating a server


ok

well i just made a linux box to act as a server

i want all my computers to connect to it


so it will be like this


internet
|
v
linux server
|
v
Switch
| | |
v v v
(Computers)

ok well i just installed 2 eithernet cards in the Server

with the one i can obtain a ip from my modem by dhcpcd eth0

now eth1 i need to act as internet sharing for the other computers

make a dhcp server for eth1?

then i will have more questions like port forwarding
firewall and stuff like that later on right now i just want my other computers to obtain a ip (192.168.1.x) from the server so i can get on them with the internet

can someone please help?
 
Old 08-24-2004, 05:47 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
http://en.tldp.org/HOWTO/IP-Masquerade-HOWTO/ will give you info on how to set your router (what you have labeled as "linux server" in your diagram) to forward packetsfor other machines on your LAN. http://www.tldp.org/HOWTO/DHCP/index.html gives info on how to get DHCP up and running. You should install the dhcpd package if it's not installed already (this is the DHCP server, not the client).

BTW I'm a big fan of the Linux Documentation Project http://www.tldp.org for finding out about stuff like this.
 
Old 08-24-2004, 06:34 PM   #3
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
I have run this sort of setup quite a bit, but mostly it's done the 'better' way.

internet
|
v
p166mmx running smoothwall
|
v
switch --> linux server
| | |
vvv
computers

which is a bit more secure, but you can certainly do it the way you have done it... The smoothwall box is just easier for me - and the kids here - and it is set up to do the routing, dhcp, IDS, firewall, etc, out of the box with a 35meg iso download...

To do it your way... what distro? You will want to ip masq and firewall and there are several tools for that to make life easier. dhcp should be easy enough to set up, though I've only ever done it with smoothwall as I usually always use static ip's

Last edited by amosf; 08-24-2004 at 06:37 PM.
 
Old 08-25-2004, 09:11 AM   #4
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Original Poster
Rep: Reputation: 30
yeah i got a problem.........


on eth0 i have dhcpcd running so then obtains the right ip from my isp (or modem)
that worked.....

eth0 Link encap:Ethernet HWaddr 00:A0:CC:E1:8B:81
inet addr:12.214.64.x Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4755 errors:1 dropped:0 overruns:0 frame:2
TX packets:1068 errors:12 dropped:0 overruns:0 carrier:24
collisions:0 txqueuelen:1000
RX bytes:752703 (735.0 Kb) TX bytes:149432 (145.9 Kb)
Interrupt:3 Base address:0x1400

the internet DOES work on my linux server.......

then i have dhcpd runninng on eth1 thats hooked to my switch
one odd thing about that is my other computers get a ip but its not in order like 192.168.1.210 and another is 192.168.1.208 (should start at 192.168.1.2) {this is not a HUGE problem}
here is eth1

eth1 Link encap:Ethernet HWaddr 00:0C:41:EA:56:3C
inet addr:192.168.1.55 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:444 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40687 (39.7 Kb) TX bytes:18726 (18.2 Kb)
Interrupt:5 Base address:0x1800

here is my dhcpd.conf

# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1;
option domain-name "hhh.hopto.org";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.210;
}


ok well anyways my client computers do get an ip from the server but theres no internet

i tried to set up ipmasq but i am not sure if i did it right

here is my rc.firewall-2.4 that the guide told me to make for a firewall and for ip forwarding


#!/bin/sh
#
# rc.firewall-2.4
FWVER=0.75
#
# Initial SIMPLE IP Masquerade test for 2.4.x kernels
# using IPTABLES.
#
# Once IP Masquerading has been tested, with this simple
# ruleset, it is highly recommended to use a stronger
# IPTABLES ruleset either given later in this HOWTO or
# from another reputable resource.
#
#
#
# Log:
# 0.75 - Added more kernel modules to the comments section
# 0.74 - the ruleset now uses modprobe vs. insmod
# 0.73 - REJECT is not a legal policy yet; back to DROP
# 0.72 - Changed the default block behavior to REJECT not DROP
# 0.71 - Added clarification that PPPoE users need to use
# "ppp0" instead of "eth0" for their external interface
# 0.70 - Added commented option for IRC nat module
# - Added additional use of environment variables
# - Added additional formatting
# 0.63 - Added support for the IRC IPTABLES module
# 0.62 - Fixed a typo on the MASQ enable line that used eth0
# instead of $EXTIF
# 0.61 - Changed the firewall to use variables for the internal
# and external interfaces.
# 0.60 - 0.50 had a mistake where the ruleset had a rule to DROP
# all forwarded packets but it didn't have a rule to ACCEPT
# any packets to be forwarded either
# - Load the ip_nat_ftp and ip_conntrack_ftp modules by default
# 0.50 - Initial draft
#

echo -e "\n\nLoading simple rc.firewall version $FWVER..\n"


# The location of the iptables and kernel module programs
#
# If your Linux distribution came with a copy of iptables,
# most likely all the programs will be located in /sbin. If
# you manually compiled iptables, the default location will
# be in /usr/local/sbin
#
# ** Please use the "whereis iptables" command to figure out
# ** where your copy is and change the path below to reflect
# ** your setup
#
#IPTABLES=/sbin/iptables
IPTABLES=/usr/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe


#Setting the EXTERNAL and INTERNAL interfaces for the network
#
# Each IP Masquerade network needs to have at least one
# external and one internal network. The external network
# is where the natting will occur and the internal network
# should preferably be addressed with a RFC1918 private address
# scheme.
#
# For this example, "eth0" is external and "eth1" is internal"
#
#
# NOTE: If this doesnt EXACTLY fit your configuration, you must
# change the EXTIF or INTIF variables above. For example:
#
# If you are a PPPoE or analog modem user:
#
# EXTIF="ppp0"
#
#
EXTIF="eth0"
INTIF="eth1"
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"


#======================================================================
#== No editing beyond this line is required for initial MASQ testing ==


echo -en " loading modules: "

# Need to verify that all modules have all required dependencies
#
echo " - Verifying that all kernel modules are ok"
$DEPMOD -a

# With the new IPTABLES code, the core MASQ functionality is now either
# modular or compiled into the kernel. This HOWTO shows ALL IPTABLES
# options as MODULES. If your kernel is compiled correctly, there is
# NO need to load the kernel modules manually.
#
# NOTE: The following items are listed ONLY for informational reasons.
# There is no reason to manual load these modules unless your
# kernel is either mis-configured or you intentionally disabled
# the kernel module autoloader.
#

# Upon the commands of starting up IP Masq on the server, the
# following kernel modules will be automatically loaded:
#
# NOTE: Only load the IP MASQ modules you need. All current IP MASQ
# modules are shown below but are commented out from loading.
# ===============================================================

echo "----------------------------------------------------------------------"

#Load the main body of the IPTABLES module - "iptable"
# - Loaded automatically when the "iptables" command is invoked
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_tables, "
$MODPROBE ip_tables


#Load the IPTABLES filtering module - "iptable_filter"
# - Loaded automatically when filter policies are activated


#Load the stateful connection tracking framework - "ip_conntrack"
#
# The conntrack module in itself does nothing without other specific
# conntrack modules being loaded afterwards such as the "ip_conntrack_ftp"
# module
#
# - This module is loaded automatically when MASQ functionality is
# enabled
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_conntrack, "
$MODPROBE ip_conntrack


#Load the FTP tracking mechanism for full FTP tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_ftp, "
$MODPROBE ip_conntrack_ftp


#Load the IRC tracking mechanism for full IRC tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_irc, "
$MODPROBE ip_conntrack_irc


#Load the general IPTABLES NAT code - "iptable_nat"
# - Loaded automatically when MASQ functionality is turned on
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "iptable_nat, "
$MODPROBE iptable_nat


#Loads the FTP NAT functionality into the core IPTABLES code
# Required to support non-PASV FTP.
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_nat_ftp, "
$MODPROBE ip_nat_ftp


#Loads the IRC NAT functionality into the core IPTABLES code
# Required to support NAT of IRC DCC requests
#
# Disabled by default -- remove the "#" on the next line to activate
#
#echo -e "ip_nat_irc"
#$MODPROBE ip_nat_irc

echo "----------------------------------------------------------------------"

# Just to be complete, here is a partial list of some of the other
# IPTABLES kernel modules and their function. Please note that most
# of these modules (the ipt ones) are automatically loaded by the
# master kernel module for proper operation and don't need to be
# manually loaded.
# --------------------------------------------------------------------
#
# ip_nat_snmp_basic - this module allows for proper NATing of some
# SNMP traffic
#
# iptable_mangle - this target allows for packets to be
# manipulated for things like the TCPMSS
# option, etc.
#
# --
#
# ipt_mark - this target marks a given packet for future action.
# This automatically loads the ipt_MARK module
#
# ipt_tcpmss - this target allows to manipulate the TCP MSS
# option for braindead remote firewalls.
# This automatically loads the ipt_TCPMSS module
#
# ipt_limit - this target allows for packets to be limited to
# to many hits per sec/min/hr
#
# ipt_multiport - this match allows for targets within a range
# of port numbers vs. listing each port individually
#
# ipt_state - this match allows to catch packets with various
# IP and TCP flags set/unset
#
# ipt_unclean - this match allows to catch packets that have invalid
# IP/TCP flags set
#
# iptable_filter - this module allows for packets to be DROPped,
# REJECTed, or LOGged. This module automatically
# loads the following modules:
#
# ipt_LOG - this target allows for packets to be
# logged
#
# ipt_REJECT - this target DROPs the pareturns
# a configurable ICMP packet back to the
# sender.
#

echo -e " Done loading modules.\n"



#CRITICAL: Enable IP forwarding since it is disabled by default since
#
# Redhat Users: you may try changing the options in
# /etc/sysconfig/network from:
#
# FORWARD_IPV4=false
# to
# FORWARD_IPV4=true
#
echo " Enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward


# Dynamic IP users:
#
# If you get your IP address dynamically from SLIP, PPP, or DHCP,
# enable this following option. This enables dynamic-address hacking
# which makes the life with Diald and similar programs much easier.
#
echo " Enabling DynamicAddr.."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr


# Enable simple IP forwarding and Masquerading
#
# NOTE: In IPTABLES speak, IP Masquerading is a form of SourceNAT or SNAT.
#
# NOTE #2: The following is an example for an internal LAN address inthe
# 192.168.0.x network with a 255.255.255.0 or a "24" bit subnetmask
# connecting to the Internet on external interface "eth0". This
# example will MASQ internal traffic out to the Internet butnot
# allow non-initiated traffic into your internal network.
#
#
# ** Please change the above network numbers, subnet mask, and your
# *** Internet connection interface name to match your setup
#


#Clearing any previous configuration
#
# Unless specified, the defaults for INPUT and OUTPUT is ACCEPT
# The default for FORWARD is DROP (REJECT is not a valid policy)
#
echo " Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

echo " FWD: Allow all connections OUT and only existing and related oIN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG

echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

echo -e "\nrc.firewall-2.4 v$FWVER done.\n"


here is my netstat -rn

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
255.255.255.255 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
12.214.64.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 12.214.64.1 0.0.0.0 UG 0 0 0 eth0



from my client computers i can ping
192.168.1.55 192.168.1.255
and thats it
i can't ping the eth0 12.214.x.x
or anything outside the network

i made sure ipforward is turned on
by doing cat /proc/sys/net/ipv4/ip_forward
and it returned a 1

i ran the rc.firewall script it didn't report and errrors
when i ran dhcpd on eth1 that didn't report and errors

what am i missing???
should i post anything else???????

i need to get internet on these client computers really, really soon

thanks!!!!!!!!

Last edited by citrus; 08-25-2004 at 10:28 AM.
 
Old 08-25-2004, 02:37 PM   #5
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Original Poster
Rep: Reputation: 30
some help would be AWESOME
 
Old 08-25-2004, 05:52 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
Try running
iptables -L
and post the results.
 
Old 08-26-2004, 10:55 AM   #7
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Original Poster
Rep: Reputation: 30
root@slackserver:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
LOG all -- anywhere anywhere LOG level warning

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
root@slackserver:~#
 
Old 08-26-2004, 10:57 AM   #8
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Original Poster
Rep: Reputation: 30
i just need to get internet working on my client computers.....
i can mess with firewall and stuff like that later.....

can someone please help?
i have exhusted my self reading thru the TLDP tutorials for ipmasq and dhcp
 
Old 08-26-2004, 11:51 AM   #9
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Original Poster
Rep: Reputation: 30
i figured it out

my client computers needed to poing to the eth1 ip address in my server

not some other shit i had

hmmm now for my wireless client

Last edited by citrus; 08-26-2004 at 12:13 PM.
 
Old 02-10-2005, 02:08 PM   #10
bkankur
LQ Newbie
 
Registered: Feb 2005
Posts: 22

Rep: Reputation: 15
problem with iptables and ipchains

hello friends,


I want to create a firewall in linux and currently i am using iptables but what is happening it wont allow large number of packets to be passed from it , the pc got hanged . if i use a packet generator tool and use it to my target pc having the fiirewall the pc got hanged.

so i am confused now what to do , is there any low level implementation of iptables like tool so that i can use it in my firewall .

waiting eagerly for the reply.

have a nice time and thanx for yr reading.
good day
om shanti.
 
Old 02-10-2005, 07:34 PM   #11
floppywhopper
Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Mageia , Centos
Posts: 644
Blog Entries: 2

Rep: Reputation: 136Reputation: 136
I dont know why you guys want to re-invent the wheel, when there are distros out there that already do this.
Like Smoothwall, IP Cop, Monowall ( BSD based ), Astaro etc etc

These distros will automatically set up a firewall, dhcp etc etc and most have excellent documentation.

but have a look here

http://www.oreilly.com/openbook/

and you'll see some books you can download
eg
Linux Network admin guide
Using Samba

also

http://www.ibiblio.org/pub/Linux/

http://www.faqs.org/docs/

http://www.icon.co.za/~psheer/book/index.html.gz

hope this helps
floppy
 
  


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
MY ISP DNS SERVER IP ...is creating some problems for my mail server daaku_n01 Linux - Networking 2 01-23-2006 06:09 PM
Creating a DNS Server mooreted Mandriva 5 11-25-2004 10:19 AM
Creating An NTP Server icedude Linux - Networking 1 11-18-2004 09:41 AM
creating one more server in linux dummyagain Linux - Networking 0 09-27-2004 01:43 AM
A few questions on creating my own server flamesrock Linux - Hardware 5 10-14-2003 06:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:43 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