LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Multiple IPs (https://www.linuxquestions.org/questions/linux-networking-3/multiple-ips-214421/)

patpawlowski 08-06-2004 05:48 PM

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

win32sux 08-06-2004 06:03 PM

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...


zaphodiv 08-08-2004 06:20 AM

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.

newpenguin 08-08-2004 06:42 AM

example
ifconfig eth0:0 192.168.100.1

amfoster 08-08-2004 07:30 AM

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.

win32sux 08-08-2004 01:58 PM

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...

patpawlowski 08-09-2004 07:54 AM

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?

amfoster 08-09-2004 09:27 AM

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


All times are GMT -5. The time now is 02:00 PM.