LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-13-2003, 12:46 AM   #1
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Rep: Reputation: 15
"ifcfg-ethx" and "network-functions" files


on my soon to be firewall using rh9, in /etc/sysconfig/network-scripts/ there are the ifcfg-ethx files for my nic's and also a network-functions file. i'm kinda new to scripts, but i think i want to use a "function" in the file specifically need_hostname for the GATEWAY=___ in my ifcfg-eth1 file because i have a dynamic ip address and i can't specify it. you can stop and tell me now if i've got it all wrong, but assuming this is right, at the top of the network-functions file it says

This file is not a stand-alone shell script; it provides functions to network scripts that source it.

so my question if i'm right so far do the ifcfg-ethx file automatically source the file, or is there a command i need to put in or something? and if i were to stick in need_hostname into GATEWAY=___, would it need quotes or anything special around it like GATEWAY="need_hostname"

again i'm just gessing at half of this so excuse me if i'm way off
 
Old 08-13-2003, 01:41 AM   #2
Vengenc
LQ Newbie
 
Registered: Aug 2003
Posts: 13

Rep: Reputation: 0
There wont be a GATEWAY= settingin the ifcfg-ethX config file.
You are correct in assuming you'll need to set a default gateway.
You can change the line (or add it as the case may be)

DEFROUTE=no
to
DEFROUTE=yes

and it will attempt make that interface the default route BUT
since you'll probably using pppoe with your dynamic connection you'll have to either try
using that line in ppp0 when the time comes or add the lines

route del default
route add default gw $5

to /etc/ip-up or if your strict about it make ip-up.local and put it in there.

for a static ip setup you simply add the line
GATEWAY=<gateway_ip>
or change it to a device with
GATEWAYDEV=<interface>

to /etc./sysconfig/network (I know you don't need this but others might)

A word of warning RH9s implementation of pppoe seems to not be "perfect"
and people are having problems with doing just this.
I wound up having to down-grade pppoe to roaring penguins current version
using

rpm -Uvh rp-pppoe.xx.xx.rpm --oldprogram

after that I reset up my pppoe connection and it actually started working.
 
Old 08-13-2003, 02:25 AM   #3
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
first, i use dhcp to connect, and i'm not sure but i'm pretty sure thats totally different from pppoe, right?

let me tell you how i started with the script. i installed my eth1 card manually because it wasn't installed automatically and therefore didn't havve a ifcfg-ethX file generated for it. i got the info from a bit dated website here:

http://www.tldp.org/HOWTO/Firewall-HOWTO-6.html#ss6.3

currently my ifcfg-eth1 file reads:

DEVICE=eth1
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
GATEWAY=
ONBOOT=yes


I filled this out from info in that howto and a bit of experience with LRP distos

stupid question: what exactly does a gateway do?

is there a listing of all the options for the ifcfg-ethX files? i wasn't able to find a man page or anything

final thought: could i just stick GATEWAYDEV=eth0 into the file?
 
Old 08-13-2003, 02:35 AM   #4
Vengenc
LQ Newbie
 
Registered: Aug 2003
Posts: 13

Rep: Reputation: 0
dhcp through an ISP highspeed router usually isnt very dynamic even though it appears that way. Usually it assigns the same IP over and over but your easiest solution is adding
GATEWAYDEV=eth0
to /etc/sysconfig/network (assuming eth0 is your ethernet card connected to the ISPs router.

A gateway setting in this case just tells the machine where to send its data by default. Some machine (like mine) have 2 or more cards with an internal LAN on one and an internet connection on the other. With no default route (or with a default route set wrong) it wont send the packets out the correct interface. Very bothersome when you're trying to surf the web
 
Old 08-13-2003, 02:50 AM   #5
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
cool thanks alot. i'll put GATEWAYDEV=eth0 in and try it. yeah i have a cable modem and my ip changes about once every 2-3 days. i'm planning on learning iptables (hopefully i can do it from the man pages) and having a server on my internal network. will this be possible or will i need to get into a DMZ (which i don't know much about).
 
Old 08-13-2003, 03:03 AM   #6
Vengenc
LQ Newbie
 
Registered: Aug 2003
Posts: 13

Rep: Reputation: 0
if you mean a server(router) so that your internal lan can use your linux machines internet connection, then yes I do it myself. the man pages are pretty easy to follow as well. If they aren't people here seem to answer fast enough
 
Old 08-13-2003, 03:10 AM   #7
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
no i mean i have the firewall/router, then i have my pc's inside, but i have another box that's a webserver that i want to run. can this just be on the internal network, or do i need another nic for a DMZ
 
Old 08-13-2003, 01:26 PM   #8
Vengenc
LQ Newbie
 
Registered: Aug 2003
Posts: 13

Rep: Reputation: 0
Well lets put it this way no matter what you can do it. You could still have a couple of different scenarios from what you describe.


------------------------
You ISPs router connects all machines to the internet.

Each PC and the Server get an ip straight from your ISP. Large ISPs do provide this now a days. In this case you really don't have an internal lan, You have 4 computers connected to the internet. You can setup a server and provide web services but all will be available to the internet. With static IPs you could setup a firewall to block all but your 3 other machines. With dynamic it'll be a little trickier and you'd probably end up just securing apache and locking the rest of the machine's ports down.
------------------------

------------------------
You use a personal router that gives all machines ip addresses and provides an internet connection for all machines as well.

This is a lot easier to setup. You can buy small routers to handle giving out local IP addresses. You can then firewall the server and allow only the traffic you wish to get to it.
------------------------

------------------------
A third scenario would be to replace the router with the Server and a hub or switch. You set up everything yourself and control everything.

Its basically the same thing but your using the linux machine with a switch as the router. This is the method I use.
------------------------

So depending on your case just pick the right setup and start working on it.

Vengenc
 
Old 08-13-2003, 04:51 PM   #9
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
this is what i'm planning:

| Internet/ISP |
v-------------|
|
^--------------|
| Cable Modem |
V--------------|
|
^--------------------|
| RH9 Firewall/Router |
v--------------------|
|
^-----|
| Hub |
|--v--|-----v------------v
|--^---| |--^---| |-----^-----|
| PC#1 | | PC#2 | | RH9 Server |
|------| |-------| |------------|



how do i configure the firewall to statically give ip's according to mac address or allow the clients to request certain ip's? (should i start a new thread for this queston?)
 
Old 08-13-2003, 05:39 PM   #10
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
When you get your dhcp server up and running you can use syntax like so

host <computername>
{
hardware ethernet <MAC Address Of Computer>
fixed-address <IP Address To Assign>
}

to assign IP's to specific computers


Or just use static addresses and type them in - voila.

Last edited by Looking_Lost; 08-13-2003 at 05:41 PM.
 
Old 08-13-2003, 05:46 PM   #11
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
cool! what's the dhcp server program that assigns ip's? that may be a stupid question but i can't figure it out. and in what script would i stick that awsome bit of configuration? thanks Looking_Lost
 
Old 08-13-2003, 05:55 PM   #12
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
I guess in red hat fashion to run it you can try

do
chkconfig --list
and if dhcpd is in the output it's installed, if not install it from your disks


/etc/init.d/dhcpd start
will probably start it

configuration file should be

/etc/dhcpd.conf

Then read up on it !!
 
Old 08-13-2003, 07:06 PM   #13
peok
Member
 
Registered: Aug 2003
Location: CA, USA
Distribution: (Almost) LFS 6.1.1
Posts: 91

Original Poster
Rep: Reputation: 15
sweet. had to install dhcpd from the cd rpm's, but that was a self taught learning experience (pretty easy too). no /etc/dhcpd.conf file, i'll have to create it i suppose. gotta read that man page a few times though! thanks again
 
  


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
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 04:07 PM
what is "/etc/sysconfig/network-scripts/ifcfg-eth0" its counterpart in slackware b0nd Slackware 2 10-06-2005 01:50 AM
learned "aliases", what are "functions" in .bashrc? learnfast Linux - Newbie 3 03-15-2005 05:24 AM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-30-2004 12:18 AM


All times are GMT -5. The time now is 07: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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration