LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-06-2004, 06:48 PM   #1
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Rep: Reputation: 30
Multiple IPs


I am running a Red Hat box as a router using iptables and we recently added 2 IP address for a total of 3. Is there anything I need to do for Linux to recognize these IPs other than porting them through iptables? Is there a way to assign more than a single IP to a network adapter. I assume you must.

-pat
 
Old 08-06-2004, 07:03 PM   #2
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Re: Multiple IPs

Quote:
Originally posted by patpawlowski
Is there a way to assign more than a single IP to a network adapter.
you can do this using inetd

http://www.google.com/linux?hl=en&lr...=Google+Search


[EDIT]

this post is bogus, MY BAD...


Last edited by win32sux; 08-08-2004 at 02:59 PM.
 
Old 08-08-2004, 07:20 AM   #3
zaphodiv
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 30
Are you sure?
Inetd is for running services like ftp servers that listen on a port. Instead of having the server software loaded all the time using up memeory inetd starts it up only when it is needed.

I think you have to set up mulitiple ip in the lower level network stuff before messing with inetd.
 
Old 08-08-2004, 07:42 AM   #4
newpenguin
Member
 
Registered: Sep 2002
Location: lahore pakistan
Distribution: slackware,redhat, FreeBSD,openbsd
Posts: 219

Rep: Reputation: 30
example
ifconfig eth0:0 192.168.100.1
 
Old 08-08-2004, 08:30 AM   #5
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
The last post is absolutely correct.

ifconfig eth0:0 xxx.xxx.xxx.xxx is the format for a second IP which will resolve to the same NIC.

ifconfig eth0:1 etc etc

These are not retained through a boot up though. To make them persistant, you need to create a file with the setup.

On Red Hat, cd to /etc/sysconfig/network-scripts. There you will see the configuration file for your network card. It is named ifcfg-eth0 You will need to make a new file named ifcfg-eth0:0 for the second "Virtual IP" address.

Once you have a ifcfg-eth0:x file for any extra IP Addresses that will be bound to that card, you simply restart the network. This will be good thru boots.
 
Old 08-08-2004, 02:58 PM   #6
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
my bad... sorry guys... i must have been trippin'... please ignore my first post, patpawlowski...

http://www.troubleshooters.com/linux/ipalias.htm


i'd like to add that iptables doesn't work with virtual interfaces, so instead of using (for example) "eth0:2", in your iptables script, use the ip you assigned to the virtual interface...
 
Old 08-09-2004, 08:54 AM   #7
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Original Poster
Rep: Reputation: 30
I have an iptables script that runs at startup. I was considering adding the appropriate commands there. The reason being that I frequently make changes to the script and this would allow me easy access to the IP configuration also. Does anyone see any problem with that?
 
Old 08-09-2004, 10:27 AM   #8
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
Sounds good to me, I'd consider having your script called from the /etc/rc.d/rc.local file.
 
  


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
Multiple IPs on one NIC - How to use them all? MG-Cloud Linux - Networking 4 10-03-2005 03:28 AM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 11:06 AM
routing multiple ips - help me! linuxxed Linux - Networking 1 02-13-2004 08:31 AM
multiple IPs, one nic v4lu3s Linux - Networking 4 02-07-2004 11:52 AM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 01:56 AM


All times are GMT -5. The time now is 08:48 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration