1752794 Members
6825 Online
108789 Solutions
New Discussion юеВ

Re: How to remove an IP

 
SOLVED
Go to solution
WW288996
Frequent Advisor

How to remove an IP

Hi,

I have executed ip addr show command and found that it has 3 IP assigned for eth0, the first IP is there in ifcfg-eth0 file, but I dont know what is the other two IPs.
The other two IPs are actually assigned to some other hosts. So I want to remove the other two IPs from this system

Please find the ip addr show command output.
Kindly help me to remove the the following two IPs from this system,10.58.121.250 & 10.58.121.251.


# ip addr show
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:21:5e:2e:55:da brd ff:ff:ff:ff:ff:ff
inet 10.58.121.193/25 brd 10.58.121.255 scope global eth0
inet 10.58.121.250/32 scope global eth0
inet 10.58.121.251/32 scope global eth0
inet6 fe80::221:5eff:fe2e:55da/64 scope link
valid_lft forever preferred_lft forever
3: eth1: mtu 1500 qdisc noop qlen 1000
link/ether 00:21:5e:2e:55:dc brd ff:ff:ff:ff:ff:ff
4: sit0: mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0


# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.58.121.193
NETMASK=255.255.255.128
HWADDR=00:21:5E:2E:55:DA
GATEWAY=10.58.121.129
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
6 REPLIES 6
Michal Kapalka (mikap)
Honored Contributor

Re: How to remove an IP

hi,

check if there exist some files :

/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth0:1

....
/etc/sysconfig/network-scripts/ifcfg-eth0:2

if yes just remove the files and if the system start again only the eth0 config will be applied.

mikap
Michal Kapalka (mikap)
Honored Contributor

Re: How to remove an IP

hi,

and of course also :

/etc/sysconfig/network-scripts/ifcfg-eth1

mikap
WW288996
Frequent Advisor

Re: How to remove an IP

there is no other configuration files under
/etc/sysconfig/network-scripts folder

___________________________________________

[root@nizamabad ~]# cd /etc/sysconfig/network-scripts/

[root@nizamabad network-scripts]# ls
ifcfg-eth0 ifdown-ippp ifdown-ppp ifup ifup-ipsec ifup-plusb ifup-sl network-functions
ifcfg-lo ifdown-ipsec ifdown-routes ifup-aliases ifup-ipv6 ifup-post ifup-tunnel network-functions-ipv6
ifdown ifdown-ipv6 ifdown-sit ifup-bnep ifup-ipx ifup-ppp ifup-wireless
ifdown-bnep ifdown-isdn ifdown-sl ifup-eth ifup-isdn ifup-routes init.ipv6-global
ifdown-eth ifdown-post ifdown-tunnel ifup-ippp ifup-plip ifup-sit net.hotplug

___________________________________________

[root@nizamabad network-scripts]# cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.58.121.193
NETMASK=255.255.255.128
HWADDR=00:21:5E:2E:55:DA
GATEWAY=10.58.121.129
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes


FLQ
Valued Contributor

Re: How to remove an IP

Hi,

try with this:

ip addr del 10.58.121.250 dev eth0
ip addr del 10.58.121.251 dev eth0

WW288996
Frequent Advisor

Re: How to remove an IP

Hi ,

Thanks for the reply
If we remove using the following command will it remove permanently,

ip addr del 10.58.121.250 dev eth0
ip addr del 10.58.121.251 dev eth0

Or if we restart the machine again will these IPs exist?
Matti_Kurkela
Honored Contributor
Solution

Re: How to remove an IP

The "ip addr del ..." commands will remove the addresses, but if something adds them back at reboot, they will be back.

Whoever has configured these addresses has apparently not used the standard method, if /etc/sysconfig/network-scripts/ifcfg-eth0:* files don't exist.

Is some sort of cluster software running on this system? It might add some extra IPs for clustered services (= "packages" if you're familiar with HP Serviceguard clustering).

You might want to look into /etc/rc.d/rc.local: if the previous sysadmin was not aware of the standard method of configuring extra IPs, s/he may have added them there.

If that does not help, you may have to try and find the configuration by brute force:

grep -r '10.58.121.250' /etc/*

This will find *all* the files in /etc where that IP address appears.

MK
MK