Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
As far as I know you cannot bind the same network address to 2 nics, you would have to have to different network id's for it to function correctly:
192.168.1.0
and:
192.168.2.0
You need to edit the /etc/dhcpd.conf file, redhat may be in a different place, I use slackware for my setup. A simple configuration would look like this:
ddns-update-style interim;
shared-network domain {
option routers 192.168.1.1; # ---> this is static ip-address of eth0
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name "domain"; # Can be domain or workgroup name
option domain-name-servers 192.168.1.1;
default-lease-time 86400;
max-lease-time 604800;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.55;
}
}
ddns-update-style interim;
shared-network domain {
option routers 192.168.2.1; # ---> this is static ip-address of eth1
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
option domain-name "domain"; # Can be domain or workgroup name
option domain-name-servers 192.168.2.1;
default-lease-time 86400;
max-lease-time 604800;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.60 192.168.2.90;
}
}
Although I have never tried 2 different cards with a dhcp server before
Distribution: Slackware 13; Ubuntu Raspberry Pi OS
Posts: 255
Rep:
Re: dhcp with multiple nic
Quote:
Originally posted by hariiyer Dear all,
I have 2 lan cards, i want to configure DHCP server for both the cards like
1) one range is 192.168.1.10 to 192.168.1.55 (eth0) and the other range for (eth1) is 192.168.1 60 to 192.168.1.90.
Is it possible? if possible how to configure. I am using redhat 9 and whitebox.
Yes, this is possible, if you use dhcpcd, then just run it for each interface.
Code:
#dhcpcd eth0
#dhcpcd eth1
The DHCP server configuration will supply the IP address when each interface bids, so controlling what interface gets what IP address is strictly controlled by the DHCP server. (I believe you will have to configure to assign IP addresses according to the MAC of the bidding machine.)
fotoguy is correct in stating that you will be assigning address in the same network assuming your netmask is 255.255.255.0.
This is not a problem if you set up your routing correctly. In your routing table there is the ability to set the metric. This is an arbitrary number that assigns the priority to interfaces in the same network. So if eth0 has metric 1 and eth1 has metric 2, then eth0 will be used first. eth1 will not be used unless eth0 is down.
Sorry I haven't provided specific configuration steps (I use Slack also), but hopefully this will help point you in the right direction.
for the dhcp server you need to note the /25 sunet mask, which in the dhcp config file will look like 255.255.255.128
and the network address of the subnets is
for eth0: 192.168.1.0
for eth1: 192.168.1.128
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940
Rep:
or do a /26 (255.255.255.192)
an you get
192.168.1.0-63 (where 0=network and 63=broadcast)
and
192.168.1.64=127 (again: 64=network and 127=broadcast)
network addresses are not usable as ip addresses and
broadcast addresses are not usable as ip addresses either
NOTE:
remember to setup the dhcp server as a router too, otherwise the 2 subnets will not be able to communicate with eachother... unless of course that is what you want :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.