Operating System - Linux
1822142 Members
3963 Online
109640 Solutions
New Discussion юеВ

IP Aliasing using DHCP in RedHat

 
SOLVED
Go to solution
Ty Roberts
Frequent Advisor

IP Aliasing using DHCP in RedHat

Does anyone know if it is possible to have IP aliasing configure two DHCP IP's for one network card under RedHat?? I have tried but to no avail, and I am wondering if it is even possible..

Thanks for all your help!
Ty
8 REPLIES 8
Stuart Browne
Honored Contributor

Re: IP Aliasing using DHCP in RedHat

What you've asked is a bit skewed. Some clarification if I could:

You have a Linux box as a client?
And you want it to get *two* addressese from a DHCP server?

If that is the case, then you set up two interfaces both of which request an address. It should get two different addresses.

(see /etc/sysconfig/network-scripts/ifcfg-eth* and /usr/share/doc/initscripts-*/sysinit.txt).

Or is it the other way around, you've got a RH DHCP server, and you want to assign a Windows PC two addresses?

I'm not sure if this can be done, but you could try over-loading the config, specifying a configuration for the MAC, and forcing two addrseses into it. No guarantee's there.
One long-haired git at your service...
Ty Roberts
Frequent Advisor

Re: IP Aliasing using DHCP in RedHat

Sorry for the confusion. I have a linux client and I am trying to get 2 IP's from a DHCP server and have one nic listen on both of those IP's. I know how to do it when just requesting one IP, but when I setup ifcfg-eth0 and ifcfg-eth0:1 with only the device name different it gives an error. I will copy and paste the 2 files and the error I receive below. Thanks for the help!!
====================
Output from command
====================
/sbin/ifup eth0
Determining IP information for eth0... done.
error in ifcfg-eth0:1: didn't specify device or ipaddr


::::::::::::::
ifcfg-eth0
::::::::::::::
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"

::::::::::::::
ifcfg-eth0:1
::::::::::::::
DEVICE="eth0:1"
BOOTPROTO="dhcp"
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"
Stuart Browne
Honored Contributor
Solution

Re: IP Aliasing using DHCP in RedHat

Hrm..

I'm gonna make some assumptions here..

You're using RH 7.x, which uses 'pump' to get it's DHCP data.

It appears as if 'pump' is limited to physical interfaces for retrieving an address.

In reality, a DHCP server uses the mac (hardware) address of a network device to differentiate it from other requests, so it probably can't assign two IP's to the same MAC.

Sorry.
One long-haired git at your service...
Steven E. Protter
Exalted Contributor

Re: IP Aliasing using DHCP in RedHat

I believe fixed ip addresses are the only practical way to achieve that.

If you follow the examples above and create a few virtual interfaces, and then monitor the interface and virutuals using a gui tool you will see this:

All the traffic is really going through the main ip address. Its tough to see the advantage of doing this with DHCP even if you could.

What you could do is have a script run right after network configuration is done.

The main ip address is say 192.168.0.20

The script does and ifconfg eth0:1 192.168.0.21 netmask 255.255.255.0 , based on adding 1 to the fourth octet of the IP address.

You just need to make sure the DHCP side reserves both addresses at run time, because this methodology will be blow up if the second ip address isn't reserved.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jerome Henry
Honored Contributor

Re: IP Aliasing using DHCP in RedHat

Hi,

Unfortunately I share our specialists advice. DHCP process is getting an IP for a MAC address, once it's done, the process is happy with that.
Maybe another way round (not sure it would work) could be, creating an alias as you did, to assign a new mac address yourself to it (being sure it's not used on your LAN of course) and check if by chance the system would assimilate this to 2 different NICs...

Good luck

J
You can lean only on what resists you...
Mark Grant
Honored Contributor

Re: IP Aliasing using DHCP in RedHat

Well, this shows how annoying all those little startup things the distributions put in really are.

Although I have never done it, there is nothing in the dhcpd man pages that suggests you can't do this, you just supply the interface name (eth0 eth0:1) on the dhcpd command line.

My suggestion therefore is to ignore all the red hat specific startup scripts and do it yourself using ifconfig and dhcpd and putting them in whatever amounts to rc.local on red hat these days.

Never preceed any demonstration with anything more predictive than "watch this"
Ty Roberts
Frequent Advisor

Re: IP Aliasing using DHCP in RedHat

Well I understand the replies saying how this is not the way to do things, but unfortunately this is the only way. Basically this server's IP are provided by an ISP (cable modem) where they only give out DHCP addresses. The IP's fairly static, were they change every 18 months or so, but they still will not tell me what my IP's are.

Mark,
How can you specify to bring up a interface using a DHCP address with ifconfig?? I am not sure how to do that, I only know how to bring it up and specify the static IP it shoudl bind to...

Thanks for all your help...
Mark Grant
Honored Contributor

Re: IP Aliasing using DHCP in RedHat

Actually, you don't need ifconfig, that was me getting over excited, though you could of course bring the card up without an ip address. However, I have never done this but imagine something like "dhcpd -t 10 -h hostname -d eth0:1" At least thats what Slackware does if you ask it to.
Never preceed any demonstration with anything more predictive than "watch this"