LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-12-2003, 09:27 AM   #1
Natalie
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Rep: Reputation: 0
Binding multiple IP addresses to a nic card


Can anyone help with binding multiple IP addresses to a nic card in Linux 7.3? I have added them and activated them, however, when I reboot, they don't all seem to "stick". Also, in GUI mode, they can show as activated, however when I type "ifconfig" in the command line, only a few will show as recognized. Thanks for any help.
 
Old 08-12-2003, 01:16 PM   #2
JRandom
Member
 
Registered: Aug 2003
Location: Grand Junction, CO, USA
Distribution: Changes monthly. Also use Solaris, IRIX, and FreeBSD (and that's just at my house!)
Posts: 40

Rep: Reputation: 15
Hello,

In Linux IP addresses other than the default (eth0:x) will not be remembered after a reboot. The best thing to do is put your ipconfig commands to add the aliases in /etc/rc.d/rc.local. If you need the interfaces to be active prior to a specific application (MySQL, Apache, etc..) you will need to set up an init script in /etc/rc.d/init.d and link to it in /etc/rc.d/rc5.d and give it a sequence # low enough to run prior to your application(s).

Ouch, I'm rambling...

--Eric
 
Old 08-12-2003, 01:20 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
Take a look at the manual:
http://www.redhat.com/docs/manuals/l...TERFACES-OTHER
 
Old 08-12-2003, 01:28 PM   #4
Natalie
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Original Poster
Rep: Reputation: 0
I am trying to set up virtual hosts using unique IP addresses. David, I looked at the manual link you provided, but it is talking about aliases, which I don't think pertains to my situation, but if I was looking in the wrong area, please let me know. Thanks for any help.
 
Old 08-12-2003, 01:33 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
Can I make sure we know what you want.

Do you want your server to have multiple DNS names AND multiple IP addresses?
OR
Do you just want multiple DNS entries poiting to the one IP address?

Is this for serving websites using apache?

What sort of network connection do you have?
 
Old 08-12-2003, 01:35 PM   #6
Natalie
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Original Poster
Rep: Reputation: 0
Ok .... I am trying to bind multiple IP addresses to one host (server). One domain name (DNS name) will be linked to numerous IP addresses, and yes, it is for websites using Apache.
Thanks for your help.
 
Old 08-12-2003, 01:38 PM   #7
Natalie
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Original Poster
Rep: Reputation: 0
David,

If multiple IP addresses cannot be bound to one DNS name, then multiple DNS names would be ok .... the thing that I'd like to ensure, though, is that I would have 5 or 6 unique IP addresses linked to this one server. Do you know how to do that? Thanks again!
 
Old 08-12-2003, 01:43 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
The doc I linked to shows you how to have multiple IP addresses on a network card. Note that you don't "need" multiple ip addresses to host multiple sites. You can just point several dns entries to one ip address then let apache's VirtualHost directive figure out which pages to serve.

If the PC does not have a public ip address then it may not be as easy to get multiple ip addresses on the system due to routing problems.

Unless there is a specific reason for wanting multiple ip addresses I wouldn't bother.
 
Old 08-12-2003, 07:27 PM   #9
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
For Red Hat systems, in /etc/sysconfig/network-scripts/ you have the configuration files for your network devices. There you will find for your first ethernet device a file ifcfg-eth0 which will contain something similar to

DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes

If you now want to bind another address to this card, then create a file
ifcfg-eth0:0 containing something similar to

DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes

Repeat for different addresses to be bound with ifcfg-eth0:1, ifcfg-eth0:2
etc. up to ifcfg-eth0:N for the (N+1)th additional address.

If you have a 2nd ethernet card, and you want to bind extra IP addresses to that, then the files would be ifcfg-eth1:0, ifcfg-eth1:1, etc

Last edited by Corin; 08-12-2003 at 07:41 PM.
 
Old 08-12-2003, 08:27 PM   #10
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
easier way:

netconfig -d eth0
netconfig -d eth0:1
netconfig -d eth0:2
netconfig -d eth0:3
.....
.....

config files will be created here.
 
  


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
Binding multiple IP Addresses to same NIC Harlin Linux - Networking 4 10-26-2005 05:10 AM
multiple ip addresses on 1 nic? houler Linux - Networking 4 04-26-2005 03:53 PM
binding multiple IPs to single NIC? lok1 Linux - Networking 2 11-16-2003 02:58 PM
Multiple addresses for a single NIC grub Programming 1 08-04-2003 02:24 AM
Multiple IP addresses on one NIC hrr Linux - Networking 2 03-07-2003 12:04 PM

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

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