chovy Site Admin

Joined: 29 Jan 2003 Posts: 2516 Location: SF Bay Area
|
Posted: Thu Jun 05, 2003 10:44 am Post subject: additing an additional ip address to your network card.... |
|
|
For redhat servers:
Ok I got this working myself by playing around and this works for me. Obviously do it at your own risk, yadda yadda, usual disclaimer.
First you need to go to the directory where this junk is
cd /etc/sysconfig/network-scripts
Then as a usual precaution I would make a backup of the file
cp ifcfg-eth0 ifcfg-eth0.bak
(you wont need to do anything with the backup)
Then copy the config for your new IP
cp ifcfg-eth0 ifcfg-eth0:1
Then we need to edit the new config
pico -w ifcfg-eth0:1
The lines you need to change:
DEVICE="eth0"
to
DEVICE="eth0:1"
Then change the
IPADDR="xxx.xxx.xxx.xxx"
to be your NEW ip address (it will have your primary ip listed)
Once this is done, press CTRL + X
then press Y and <enter>
This will have saved the config for you and the interface is ready to be brought up. This is done with
/sbin/ifup eth0:1
Having done this if you type
/sbin/ifconfig
You should see something like
------code------
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55818546 errors:0 dropped:0 overruns:0 frame:0
TX packets:46167836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3299680715 (3146.8 Mb) TX bytes:1890963825 (1803.3 Mb)
Interrupt:11 Base address:0xd000
eth0:1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:NEW.IP.ADDRESS Bcast:xxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xd000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:241244 errors:0 dropped:0 overruns:0 frame:0
TX packets:241244 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:66571100 (63.4 Mb) TX bytes:66571100 (63.4 Mb)
------/code------
If you then try to ping your new ip it should all work fine
This should also restart eth0:1 on a reboot as its a direct copy of the eth0 config. So checking for the ONBOOT="yes" in ifcfg-eth0:1 will ensure it DOES come back up on a reboot.
Hope this helps, and if it doesnt work please let me know so I can investigate where I made a mistake.
Perhaps I should post this to HOW-TO since I too couldnt find it. _________________ Free Internet Directory | Shopping Directory | Electronics Directory | SEO Forum |
|