LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices

Reply
 
Search this Thread
Old 11-22-2005, 05:02 PM   #1
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
Multiple static IP addresses


The LFS book doesn't indicate how the network script handles multiple static IP addresses on a single interface. I know it can be done because back in July I was told that the feature already existed. I hadn't used it then, and can't seem to find any documentation for it at all.
 
Old 11-22-2005, 05:46 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
What you are after is IP alaising. What it means is the first IP is say eth0 and the next IP will be eth0:0, the next one will be eth0:1. If you need to work with iptables then IP alising does not work with it. Use the IP address itself, do not use references eth0:0.

Here are some links to look over. Some stray from the subject.
http://www.linuxquestions.org/questi...00#post1946000
http://www.linuxquestions.org/questions/history/66791
http://archives.neohapsis.com/archiv...0-q2/0239.html
http://iptables-tutorial.frozentux.n...-tutorial.html

Any questions please ask away.
Brian1
 
Old 11-22-2005, 06:31 PM   #3
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Original Poster
Rep: Reputation: 30
Thanks for your response, but, I don't see how iptables is necessary for what I require. In some way (that isn't documented, afaik) the LFS network script(s) provide the functionality I need, I just don't know where/how to put the necessary configuration information.

Code:
[root@fo ~]# ls -l /etc/sysconfig/network-devices/ifconfig.eth0/
total 4
-rw-r--r--  1 root root 101 Nov 18 02:48 ipv4

Do I create multiple ipv4 files? What will the new ones be named? Do I create multiple ifconfig.eth0 directories, naming them ifconfig.eth0:0, 1, 2, etc. ?


[edit]
Based from reading the scripts themselves, I think that the scripts do not, in any way, require the name of the file to be 'ipv4'. I am pretty sure that, I could rename the ipv4 file I have above to my main IP. Then, I would just create as many other files as I needed for the remaining IPs.

But I'll wait to see what anyone else has to say.
[/edit]

Last edited by fr0zen; 11-22-2005 at 06:37 PM.
 
Old 11-22-2005, 07:34 PM   #4
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
If rerouting of ip is not needed then iptable syou will not need for this. A easy to use gui tool for this is an app called webmin. http://www.webmin.com . In the networking section under the interface section, it allows creation of virtual aliasing IPs.

Some more links
http://www.faqs.org/docs/Linux-mini/IP-Alias.html
http://www.troubleshooters.com/linux/ipalias.htm

Hope this helps.
Brian1
 
Old 11-22-2005, 08:49 PM   #5
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Original Poster
Rep: Reputation: 30
Thank you Brian for your help. However, I decided to try my method (which I had discovered based on the script itself).

I now have several files under the eth0 directory, each named with the IP I plan to assign on the device.

PHP Code:
[root@fo /etc/sysconfig/network-devices/ifconfig.eth0]# ls -l
total 20
-rw-r--r--  1 root root 72.36.***.**1
-rw-r--r--  1 root root 72.36.***.**2
-rw-r--r--  1 root root 72.36.***.**3
-rw-r--r--  1 root root 72.36.***.**4
-rw-r--r--  1 root root 72.36.***.**5
/* --- */

// Individual files

[root@fo /etc/sysconfig/network-devices/ifconfig.eth0]# cat 72.36.***.**1
ONBOOT=yes
SERVICE
=ipv4-static
IP=72.36.***.**1
GATEWAY
=put your gateway IP here
PREFIX
=specify your prefix (based on netmask)
BROADCAST=broadcast addr here
/* --- */

// This last one is a template for the 'secondary' ips that you have. I have 4 of them.
// # = {2,3,4,5}

[root@fo /etc/sysconfig/network-devices/ifconfig.eth0]# cat 72.36.***.**#
ONBOOT=yes
SERVICE
=ipv4-static
IP=72.36.***.**#
PREFIX=same prefix as main file
/* --- */ 
I hope this helps anyone else. I really really wish they'd put a note about this in the LFS book! (I was told it wasn't important enough...)
 
Old 11-23-2005, 06:47 PM   #6
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Glad to be of help. There is more than one way to do anything in linux.

Brian
 
  


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
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 10:51 AM
mixing static and dynamic ip addresses bobwall Linux - Networking 5 07-21-2004 07:47 PM
LAN with static IP addresses and shared internet connection #2 Klas Linux - Networking 10 01-26-2004 10:43 AM
LAN with static IP addresses and shared internet connection Klas Mandriva 1 01-21-2004 07:14 PM
2 static IP addresses on 2 eth cards Zingaro2002 Linux - Networking 8 01-21-2003 12:16 PM


All times are GMT -5. The time now is 09:08 PM.

Main Menu
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