Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Network Troublshooting => General Networking Support in Linux => Topic started by: shipoin_97 on November 15, 2005, 05:36:19 AM
-
SIr .
I have a NIC card in my Linux pc . I add two IP using Aliasing if that NIC card , i mean i used "eth0" and "eth0:0" . Now i have two questions :
1) When i add the ip in eth0:0 , how i remove that ip
and
2) when i strart "service network restrart " , then the ip of eth0:0 will gone . i don't find that ip
Can anyone plz explain why this situation is occured and how i get remove this problem .
-
Hello,
Follow these steps to IP Alias
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Edit the following
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
USERCTL=no
PEERDNS=yes
TYPE=Ethernet
DEVICE=eth0:0 (Change This First when Alaising)
HWADDR=00:d0:b7:c3:aa:0e
BOOTPROTO=none
NETMASK= (U R Netmask)
ONBOOT=yes
IPADDR= (U R IP Address)
save the setting
# service network restart
# ifconfig
u will get the ip
if any problem mail me.
Regards,
Vijay
-
Friend, i believe u r trying to do virtual ip on a same NIC.
I suggest u to do these:
========
Requirement
========
1. One NIC (eth0)
========
Question 1
========
1. You just answered it yourself, restart the eth0 device
2. If haf more than one eth (say eth0, eth1, eth2), and u wanna clear of eth0, or eth0:0 or eth0:1 only. U can do this:
bash# ifdown eth0;ifup eth0
NOTE: THIS IS ONLY FOR REDHAT/FEDORA CORE ONLY
========
Question 2
========
Hmm, as mentioned above, what are u trying to do is to create another virtual NIC (with a virtual IP). It's not real, and definitely it's gone after reboot since it's not persistent.
If u want a virtual ip always exist everytime u restart your NIC or reboot or start ur Linux. Do this:
login as: root
root@192.168.0.123's password:
Last login: Tue Jan 24 01:17:00 2006
[root@rh9 root]# cd /etc/sysconfig/network-scripts/
[root@rh9 root]# cp -a ifcfg-eth0 ifcfg-eth0_1
===========================
And your should set the virtual ip like this
===========================
DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.123
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
[root@rh9 root]# service network restart
For your information, this is done for Redhat 9, applies to all Redhat Distros including Fedora Core.
For Slackware users, if u do requests for it, u can PM me to do so. I will put it here as well ;)