LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 05: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, 06:03 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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 01:59 PM.
 
Old 08-08-2004, 06: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, 06: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, 07:30 AM   #5
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 36
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, 01:58 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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, 07: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, 09:27 AM   #8
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

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


Reply



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 02: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 10:06 AM
routing multiple ips - help me! linuxxed Linux - Networking 1 02-13-2004 07:31 AM
multiple IPs, one nic v4lu3s Linux - Networking 4 02-07-2004 10:52 AM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 12:56 AM

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

All times are GMT -5. The time now is 07:40 AM.

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