LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-29-2003, 10:03 AM   #1
tangaz
Member
 
Registered: Sep 2003
Location: India
Posts: 31

Rep: Reputation: 15
Networking...DHCP


Help!!!
I have 2 machines,running Windows XP(on Laptop) and a dual boot on a PC( Linux and Win XP).
Problem>>I have 2 NIC on the PC, on one card i put the folowing IP Address 192.168.0.1 with subset 255.255.255.0
and on the other card i put the address 203.196.174.231 which links to my ISP.
I want the Pc to issue Ip addresses to the laptop(as the DHCP) ...which is not happening.

I then installed Samba and listed the users who log on to the laptop.(which i think was wrong).
I then re-read the guide and realised that the DHCP was not configured as i thought it automatically configures itself since i had put an APIPA add...
I then installed the DHCP from the CD and tried to install it using the file /etc/dhcpd.conf but the file is nowhere to be found.
I then went to //services and started dhcpd and saved it (so it always start the service i think)But it still wont work.
Wht do i do?
Uninstall Samba?
Should i remove the IP address on the card and make it DHCP???
 
Old 10-05-2003, 01:27 AM   #2
clacour
Member
 
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98

Rep: Reputation: 16
First, let me see if I understand what you're saying:

You have a desktop PC which is dual-boot Linux and XP.

You have a laptop that runs XP.

You want the desktop (when it is running Linux) to provide DHCP service to the laptop.

The desktop also has a second NIC which has your Internet IP address. I suspect you want Linux to be a gateway to the internet for your laptop, in addition to providing it an IP address. (And if you don't have some other kind of firewall, I'm telling (not asking) you, you want Linux to be a firewall, too.)

You didn't say what distribution you're using. I'm going to describe things in terms of Red Hat, since that's what I'm most familiar with.

There are two separate packages "dhcpcd" (which is the client) and "dhcp-server" which is the server (the "dhcp-server" might be called just "dhcpd" (no "c" in front of the final "d")). If you don't have dhcpd.conf, you probably have the client installed rather than the server.

Samba is for doing file-sharing between a Linux box and a Windows machine. It's something that happens after all the machines involved already have their network stuff working. It doesn't hurt anything to have it on your system, but you're several steps away from doing anything with it.

When you're editing your dhcpd.conf file it should look something like this:

Quote:
option domain-name "clacour.com";
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.1.255;
option routers 10.1.1.200;
option domain-name-servers 10.1.1.1;
ddns-update-style ad-hoc;

subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.2 10.1.1.250;
}
The domain name can be whatever you want - it's mainly going to get used when you put a partial system name in. Mine happens to be real -- I really do have "clacour.com", but it doesn't have to be a real one. (You can also leave it out entirely.)

The "option routers" and "option domain-name-servers" lines are important. They are what tell all your client machines what to use as a default gateway (the "option routers" line) and where to go for DNS info. I run my own caching-only DNS service, because my ISPs DNS servers are atrocious. If you've been getting on the Internet with XP on the desktop, run "winipcfg" and get the DNS info from that. While you're there, get the gateway info, too.

The gateway that you put on the options routers line is NOT going to be what your ISP says the gateway is. It's going to be the internal address of your desktop.

Let's say you set up the desktop (internally) as 10.1.1.1. DHCP gives the laptop 10.1.1.2. When the laptop tries to get to the Internet, it's going to look at it's own internal stuff and see "my gateway is 10.1.1.1", so that's where it will send the packet.

Your desktop, on the other hand, WILL have your ISPs gateway as its gateway. It will get the packet from the laptop, look at the IP address and say "No clue where that is. Time to hand it off to the gateway. Let's see, my gateway is 203.196.174.xxx" (whatever your ISP told you).

I really hope you're using Red Hat, because this next piece is simple if you are, and could get pretty hairy if you're not.

Install the package "redhat-config-securitylevel", then run it to set up your firewall. After you've done that, set up your kernel to do ip-forwarding, and you should be all set. I'm deliberately not telling you how to turn on ip-forwarding yet. I want to be real sure you have a firewall working first.

In fact, if you can get out to the Internet from the desktop now, make the firewall your top priority. Red Hat ships with a fairly secure setup, but the more protection the better.

Good luck,

CHL
 
Old 10-05-2003, 10:43 AM   #3
tangaz
Member
 
Registered: Sep 2003
Location: India
Posts: 31

Original Poster
Rep: Reputation: 15
Thanx Clacour!!!
Sorrry for the inadeqeacy of informatio!!!
I run Redhat linux 9 on the desktop.Yes i want the Linux desktop to issue IP addresses to the laptop (as the DHCP) just like i do when running XP on on both.Yes i want Linux to implement a firewall and enable Internet Connection so that the laptop has access to the internet through the Linux Desktop.

The file dhcpd.conf is "not found" i think i never installed the sever but the client instead.

One more problem is that i cant get online on the Linux due to a combination of two things
First i have two NICs on the desktop as i said before on one card linking to the Internet i have configured it as follows:
IP Address:203.196.174.xxxx
Sbnet Mask:255.255.255.224
Default gateway:203.196.174.xxx1
the Default gateway is also the DNS on my XP (as provided by ISP)
On the DNS i added the above address too but did not provide a "Search path"
Should i add my Ip Address to the Hosts???
These settings work well in Xp but in XP i also have a custom aunthentication (.exe) file which wont work in Linux but my ISP has told me that I don need it on Linux so i figure its my screw up.
On the other NIC which connects to the Laptop i had put the following:
IP Address:192.168.0.1
Submask:255.255.255.0
So from what you have said i have to change this part completely

please send me more corrections before i screw up even more
 
Old 10-05-2003, 04:50 PM   #4
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
What do you mean "i have configured..."

what type of internet connection do you have? PPPoE or DSL or CABLE?

what do you mean you configured the nic connected to your ISP?...manually?...isn't the ip information automatically given...DHCP?


let me know
 
Old 10-05-2003, 10:36 PM   #5
chrisfirestar
Member
 
Registered: Sep 2003
Location: Adelaide, Australia
Distribution: Fedora/RH
Posts: 231

Rep: Reputation: 30
is that doesnt work try this:

$ cd /etc/
$ vi dhcpd.conf

# ENTER THE FOLLOWING (changing to suit your network)

ddns-update-style interim;

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers primaryDNSip, secondardDNSip;
# option domain-name "example.com";

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.11 192.168.0.100;
}



# THEN!

$ cd /etc/sysconfig/
$ vi dhcpd

# Command line options here
# Where eth# is eth card connected to the local network
# you want to use DHCP for

DHCPDARGS=eth1


hope this helps
 
Old 10-07-2003, 01:15 AM   #6
tangaz
Member
 
Registered: Sep 2003
Location: India
Posts: 31

Original Poster
Rep: Reputation: 15
Think i got into more trouble again!!!After hours of looking for the file /etc/dhcpd.conf i decided to do wht Chrisfirestar said ..so i
$cd /etc/
$vi dhcpd.conf and copied the entire paragraph on to the file..i couldnt find how to save it or quit the file so i jus closed it and thot all was well.
I then went on to the next step but had problems coz the file
"$vi dhcpd" was a read only and the it showed something like this
# Command line options here
DHCPDARGS=
( without eth#)
I then thought i could go around it by being the super user so i SU -m into the /etc/sysconfig/
and did a $vi dhcpd
I closed the file again without saving or anything and tried opening them (the 2 files) but still could not find them
So i decided to re-do the whole procedure with the hope that if the files were there i would get them and here is wht i get:::
E325: ATTENTION
Found a swap file by the name "/var/tmp/dhcpd.conf.swp"
owned by: tangaz dated: Mon Oct 6 18:11:20 2003
file name: /etc/dhcpd.conf
modified: YES
user name: tangaz host name: localhost.localdomain
process ID: 2406
While opening file "dhcpd.conf"

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r dhcpd.conf"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/var/tmp/dhcpd.conf.swp"
to avoid this message.

Swap file "/var/tmp/dhcpd.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (D)elete it:

And on trying to open and edit /etc/sysconfig/dhcpd here is wht i get:::
E325: ATTENTION
Found a swap file by the name ".dhcpd.swp"
owned by: root dated: Mon Oct 6 18:20:11 2003
file name: /etc/sysconfig/dhcpd
modified: YES
user name: root host name: localhost.localdomain
process ID: 2586
While opening file "dhcpd"
dated: Mon Feb 3 21:56:15 2003

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r dhcpd"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".dhcpd.swp"
to avoid this message.

Swap file ".dhcpd.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (D)elete it:

On pressing R here is wht i get
Swap file ".dhcpd.swp" already exists!
"dhcpd" 2L, 39C
Swap files found:
Using specified name:
1. .dhcpd.swp
owned by: root dated: Mon Oct 6 18:20:11 2003
file name: /etc/sysconfig/dhcpd
modified: YES
user name: root host name: localhost.localdomain
process ID: 2586
In directory ~/tmp:
-- none --
In directory /var/tmp:
2. dhcpd.swp
owned by: tangaz dated: Mon Oct 6 18:17:15 2003
file name: /etc/sysconfig/dhcpd
modified: YES
user name: tangaz host name: localhost.localdomain
process ID: 2495
In directory /tmp:
-- none --
Enter number of swap file to use (0 to quit):
Using swap file "/var/tmp/dhcpd.swp"
Original file "/etc/sysconfig/dhcpd"
Recovery completed. You should check if everything is OK.
(You might want to write out this file under another name
and run diff with the original file to check for changes)
Delete the .swp file afterwards.

I dont knw what and where i went wrong but i think i created two files of the same kind in /etc/sysconfig/..

How do i delete these files and start over???
The dhcpd is installed and is running in the services but i dont see the DHCp in the servers.
Your help will be appreciated.
 
Old 10-07-2003, 02:49 AM   #7
chrisfirestar
Member
 
Registered: Sep 2003
Location: Adelaide, Australia
Distribution: Fedora/RH
Posts: 231

Rep: Reputation: 30
ok type: rm -fr filename

this forces and makes it recursive (not needed in this case but good practice for deleting folders etc)

when u edit the file using vi you hit "i" to enter INSERT mode then you make the changes... hit ESC then type ":wq"

try again
 
Old 10-09-2003, 08:49 PM   #8
clacour
Member
 
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98

Rep: Reputation: 16
You might want to try nano, instead of vi:
"nano /etc/dhcpd.conf"

It's not nearly as powerful as vi, but it's a lot easier for a beginner.
 
Old 10-10-2003, 11:00 AM   #9
tangaz
Member
 
Registered: Sep 2003
Location: India
Posts: 31

Original Poster
Rep: Reputation: 15
Thanx guys think now at least the files have been deleted but couldnt manage to create new ones in the ordinary account so eventually did it in the root account.I hope this is not a problem.tell me before i connect these things.
Also anyone with a good link to "how to ppp/pppoe" I think i might need that to connect to my ISP.
Your advice is well appreciated
 
Old 10-10-2003, 11:13 AM   #10
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Moved: More suitable in the Networking forum. Regards.
 
Old 10-24-2003, 02:27 PM   #11
tangaz
Member
 
Registered: Sep 2003
Location: India
Posts: 31

Original Poster
Rep: Reputation: 15
Hey guys finally i got online using Linux and configured the DHCPD and redhat-config securitylevel set to medium.Now how do i turn on the Ip-forwarding.
Also apparently on getting to a site on my browser(Mozilla0 i can not download any file.
When i click download the messege comes to ask if i want to save to disk.If i click "Yes" all the open windows of mozilla automatically close even those from which i would be not be downloading.I tried to download Opera and this kept happening then i tried also to download the yahoo messenger for Linux and same thing.Think will jus do it in windows and then install from Cd or something.
 
Old 10-24-2003, 08:50 PM   #12
clacour
Member
 
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98

Rep: Reputation: 16
Turn on IP-forwarding by saying:

echo 1 > /proc/sys/net/ipv4/ip_forward

(echoing a "0" to it will turn it off, if you ever need to.)

People usually put this either in rc.local (/etc/rc.d/rc.local, if you need the full path), or in their firewall script (a bunch of iptable commands).

Which file and when you execute it is unimportant. As soon as you echo the "1" to that (imaginary) file, ip-forwarding will start working. (One note. There's also an iptables (or ipchains, if you're using the old stuff) rule for forwarding that you need to have. This pair of commands should work:

/usr/sbin/iptables -A forward -s linux-ip -d <firewall IP> -j ACCEPT
/usr/sbin/iptables -t nat -A POSTROUTING -o <external interface> -j MASQUERADE

Substitute whatever values for <firewall IP> and <external interface> are appropriate to your system ("10.1.1.1" and "eth0", for example).
 
  


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
DHCP Networking Issues knobdy SUSE / openSUSE 9 10-18-2005 01:50 PM
Using 1 NIC for DHCP the other for all other networking FlyingPenguin128 Linux - Networking 0 05-19-2005 07:37 PM
dhcp networking comtronics Linux - Networking 3 10-08-2003 08:45 AM
Slackware DHCP networking truiken Linux - Networking 4 12-17-2002 03:46 PM
using dhcp and networking thunderrooster Linux - Networking 0 08-26-2001 01:05 AM

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

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