Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-17-2005, 05:13 PM
|
#1
|
LQ Newbie
Registered: Oct 2004
Location: Zagreb, Croatia
Distribution: CentOS 4.4
Posts: 24
Rep:
|
CentOS 4.2: Multiple IPs on a single NIC
Hi guys,
I need to setup 2 additional IPs on a single NIC. Since this is a live box to which I presently have SSH access only, I need to be really careful doing this, so I thought I'd better ask.
CentOS 4.2.
What I have learned until now (correct me if wrong) is that
eth0 ---> remains as is, with the main IP and with /etc/sysconfig/network-scripts/ifcfg-eth0 staying as is with settings:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=BOX.BROAD.CAST.ADDRESS
HWADDR=00:10:2E:61:8B:AA
IPADDR=MAIN.BOX.IP.ADDRESS
NETMASK=255.255.255.0
NETWORK=NET.WORK.IP.ADDRESS
ONBOOT=yes
TYPE=Ethernet, and
eth0:0 with /etc/sysconfig/network-scripts/ifcfg-eth0:0 and
eth0:1 with /etc/sysconfig/network-scripts/ifcfg-eth0:1
for additional (aliased) IPs, with the difference in only the DEVICE= and IPADDR= lines.
Do I create the virtual interfaces using the
ifconfig eth0:0 IP.ADDRESS.NUMBER.2 \ netmask 255.255.255.0 up and
ifconfig eth0:1 IP.ADDRESS.NUMBER.3 \ netmask 255.255.255.0 up commands?
I have checked the kernel's .config, the ip_alias wasn't compiled in, so I believe I would have to load it? Do I need it? If needed, how to load it and make it load on boot?
Do I need to set the routes up like:
/sbin/route add -net 127.0.0.0
/sbin/route add -net MAIN.BOX.IP.ADDRESS dev eth0
/sbin/route add -host MAIN.BOX.IP.ADDRESS dev eth0
/sbin/route add -host IP.ADDRESS.NUMBER.2 dev eth0:0
/sbin/route add -host IP.ADDRESS.NUMBER.3 dev eth0:1
/sbin/route add default gw GATE.WAY.BOX.IP ?
Is this correct? What needs to be changed/corrected/omitted/done?
Please be kind and give me a hand, I have read several different HOWTOs and I am still not sure what to do?
|
|
|
12-17-2005, 05:19 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
you shouldn't need to directly mess with your routing table, just the additional icfg files should be required. infact you don't need to do that to test if it works or not, just use ifconfig to add additional IP's. "ifconfig eth0:1 192.168.0.2/24" etc... if that works then firm it up with the persistent config files.
|
|
|
12-17-2005, 05:35 PM
|
#3
|
LQ Newbie
Registered: Oct 2004
Location: Zagreb, Croatia
Distribution: CentOS 4.4
Posts: 24
Original Poster
Rep:
|
Thanks acid_kewpie, I have just tested this on my local CentOS box I am connecting to from the other box with SSH. Entered ifconfig as you proposed, pinged from the other box... working perfectly. Added the ifcfg-eth0:1, rebooted, works perfectly.
So simple...
Thanks a lot, you have helped me a lot!
|
|
|
All times are GMT -5. The time now is 02:13 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|