LinuxQuestions.org
Visit Jeremy's Blog.
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 02-23-2006, 11:10 AM   #1
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
dhcp with two NIC cards


My Fedora Core 2 computer has two NIC cards.
How to assign different IP addresses to them (eth0 and eth1) dynamically by dhcp?

My dhcpd.conf is:
ddns-update-style interim;

subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
range 192.168.0.2 192.168.0.254;
}

subnet 192.168.3.0 netmask 255.255.255.0 {
option routers 192.168.3.1;
range 192.168.3.2 192.168.3.254;
}

ifcfg-eth0 and ifcfg-eth1 are similar.
/etc/sysconfig/network-scripts/ifcfg-eth1 is:
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:30:48:83:E9:11
ONBOOT=yes
TYPE=Ethernet
DHCP_HOSTNAME=rose
USERCTL=no
IPV6INIT=no
PEERDNS=no

Last edited by powah; 02-23-2006 at 11:14 AM.
 
Old 02-23-2006, 12:12 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
you would presumably just use the mac address in the dhcpd.conf to assign the addresses per hardware item.
 
Old 02-23-2006, 01:55 PM   #3
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Original Poster
Rep: Reputation: 30
I want to assign two different subnet addresses.
e.g.
eth0 get 192.168.0.2
eth1 get 192.168.3.2

/etc/dhcpd.conf is now:
ddns-update-style interim;

subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
range 192.168.0.2 192.168.0.254;
}

subnet 192.168.3.0 netmask 255.255.255.0 {
option routers 192.168.3.1;
range 192.168.3.2 192.168.3.254;
}


host rose {
hardware ethernet 00:30:48:83:E9:11;
fixed-address 192.168.3.2;
}


# /usr/sbin/dhcpd eth1
Internet Systems Consortium DHCP Server V3.0.1rc14
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 4 leases to leases file.

No subnet declaration for eth1 (0.0.0.0).
** Ignoring requests on eth1. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth1 is attached. **
 
Old 02-23-2006, 02:38 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
ok, what do you actually want to achieve... if YOU are the DHCP server, then don't use DHCP. you can't give yourself leases. or at least shouldn't. if you are not the DHCP server then you will be given a dhcp address suitable for the netwrok that you are responding on. it's implicit that they will get the right ones as they are on different networks.
 
Old 02-23-2006, 03:06 PM   #5
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Yuo have posted the config file for a DHCP *server* but it sounds like you want to be a DHCP *client*. If you want your computer to automatically get the right addresses for two networks it is connected to, plug them in and enable DHCP (client) on the network cards.

If you want to make it give other systems on the networks addresses then set up a DHCP server using something similiar to your config file. Start dhcpd, the DHCP server daemon, with paramater for each network card (something like /sbin/dhcpd eth0 eth1) and then *statically set a manual IP address to each network interface.* If your system doesn't have a network interface with a static IP on that subnet, the DHCP server will not give out addresses in that range and in some cases will not even start.
 
Old 02-23-2006, 03:12 PM   #6
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Original Poster
Rep: Reputation: 30
I am sorry for the confusion, let me clarify:
I want to setup a Fedora core 2 dhcp server which has two NIC cards (eth0 & eth1). Any computers (e.g. computer A) connecting to eth0 will get IP addresses from 192.168.0.3 to 192.168.0.254; any computers (e.g. computer B) connecting to eth1 will get IP addresses from 192.168.3.3 to 192.168.3.254.
e.g.
eth0 get 192.168.0.2
eth1 get 192.168.3.2
computer A get 192.168.0.3 to 192.168.0.254
computer B get 192.168.3.3 to 192.168.3.254
 
Old 02-23-2006, 03:27 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
well that's still as clear as mud really... but you would just assign a range the fits with the subnet on each eth interface. if a dhcp request is recieved on a client reaching the server from 192.168.3.x then it would be given one address from the 192.168.3.x pool.
 
Old 02-23-2006, 03:28 PM   #8
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Quote:
Originally Posted by Darin
*statically set a manual IP address to each network interface.* If your system doesn't have a network interface with a static IP on that subnet, the DHCP server will not give out addresses in that range and in some cases will not even start.
To set a NIC's IP address from the command line it's ifconfig eth0 192.168.0.2 netmask 255.255.255.0 but to set it up permanantly either edit the startup script or use one of the graphical config tools in FC.
 
  


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
Add more NIC cards nkutty Linux - Networking 1 08-06-2005 12:02 AM
Combining 'NIC Cards astroboiii Linux - Networking 4 01-06-2005 01:57 AM
Networking with 2 Nic Cards FXRS Fedora 2 12-06-2003 08:35 AM
NIC cards setup Bink Linux - Hardware 6 07-29-2003 11:41 PM
NIC Cards Not Working bennieblanco Linux - Networking 0 07-20-2003 11:17 PM

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

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