apps-infra

    Forum Stats

  • 3,874,067 Users
  • 2,266,672 Discussions
  • 7,911,721 Comments

Discussions

ip addr show showing 2 IPs in same Network Card

MSABRA
MSABRA Member Posts: 7 Red Ribbon

Hi

 ip addr command show showing 2 IPs in same nic card. Actually one ip is assigned by DHCP server during OS installation and we want to get rid off this ip we want to use only static ip assigned to Server.

I tried with below command but after reboot again ip is getting assigned to nic card.

ip addr del x.x.x.x/24 dev eth0

I also edited my ifcfg-eth0 like below but still after reboot i am getting 2 ips address.

[[email protected] network-scripts]# pwd

/etc/sysconfig/network-scripts

[[email protected] network-scripts]#

[[email protected] network-scripts]# cat ifcfg-eth0

TYPE="Ethernet"

PROXY_METHOD="none"

BROWSER_ONLY="no"

BOOTPROTO="static"

DEFROUTE="yes"

IPV4_FAILURE_FATAL="no"

IPV6INIT="yes"

IPV6_AUTOCONF="yes"

IPV6_DEFROUTE="yes"

IPV6_FAILURE_FATAL="no"

IPV6_ADDR_GEN_MODE="stable-privacy"

NAME="eth0"

UUID="e83c3691-8c75-4611-8cc1-16a5089c13ca"

DEVICE="eth0"

ONBOOT="yes"

IPADDR="x.x.x.x"

GATEWAY="x.x.x.x"

DNS1="x.x.x.x"

DNS2="x.x.x.x"

IPV6_PRIVACY="no"

NM_CONTROLLED="no"

[[email protected] network-scripts]#

Kindly help regarding this.


Best Regards

Jamsher

Comments

  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    Hi,

    Anybody can help or suggest please.


    Best Regards

    Jamsher

  • remzi.akyuz
    remzi.akyuz Member Posts: 199 Bronze Badge

    Hi,

    Did you check network configuration via nmcli?

    nmcli con show

    nmcli con show connection_name

  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    I have stopped NetworkManager.

    [[email protected]  network-scripts]#

    [[email protected] network-scripts]# nmcli con show

    Error: NetworkManager is not running.

    [[email protected]  network-scripts]#

  • remzi.akyuz
    remzi.akyuz Member Posts: 199 Bronze Badge

    BOOTPROTO="static"

    should be none. could you set it:

    BOOTPROTO="none"

    then reboot.


    more information:


    BONDING_OPTS=parameters

    sets the configuration parameters for the bonding device, and is used in /etc/sysconfig/network-scripts/ifcfg-bondN (see Section 11.2.4, “Channel Bonding IntBOOTPROTO="static"erfaces”). These parameters are identical to those used for bonding devices in /sys/class/net/bonding_device/bonding, and the module parameters for the bonding driver as described in bonding Module Directives.

    This configuration method is used so that multiple bonding devices can have different configurations. In Red Hat Enterprise Linux 6, place all interface-specific bonding options after the BONDING_OPTS directive in ifcfg-name files. See Where to specify bonding module parameters for more information.

    BOOTPROTO=protocol

    where protocol is one of the following:

    • none — No boot-time protocol should be used.
    • bootp — The BOOTP protocol should be used.
    • dhcp — The DHCP protocol should be used.


    MSABRA
  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    @remzi.akyuz

    I had tried with below parameter but still there was 2 IP even after reboot.

    BOOTPROTO="none"

    I will try once again and update accordingly


    Thanks & Best Regards

    Jamsher

  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    @remzi.akyuz

    Followed below steps still after reboot NIC have 2 ips.

    [[email protected] ~]#

    [[email protected] ~]# ip addr

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

      inet 127.0.0.1/8 scope host lo

        valid_lft forever preferred_lft forever

      inet6 ::1/128 scope host

        valid_lft forever preferred_lft forever

    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

      link/ether 50:6b:8d:eb:fe:43 brd ff:ff:ff:ff:ff:ff

      inet x.x.x.x/8 brd 10.255.255.255 scope global eth0

        valid_lft forever preferred_lft forever

      inet x.x.x.x/24 brd 10.250.40.255 scope global dynamic eth0

        valid_lft 28734sec preferred_lft 28734sec

      inet6 fe80::526b:8dff:feeb:fe43/64 scope link

        valid_lft forever preferred_lft forever

    [[email protected] ~]#

    [[email protected] ~]#

    [[email protected] ~]# cd /etc/sysconfig/network-scripts/

    [[email protected] network-scripts]#

    [[email protected] network-scripts]# vi ifcfg-

    ifcfg-eth0   ifcfg-eth0.bkp ifcfg-lo

    [[email protected] network-scripts]# vi ifcfg-eth0

    [[email protected] network-scripts]#

    [[email protected] network-scripts]# cat ifcfg-eth0

    TYPE="Ethernet"

    PROXY_METHOD="none"

    BROWSER_ONLY="no"

    BOOTPROTO="none"

    DEFROUTE="yes"

    IPV4_FAILURE_FATAL="no"

    IPV6INIT="yes"

    IPV6_AUTOCONF="yes"

    IPV6_DEFROUTE="yes"

    IPV6_FAILURE_FATAL="no"

    IPV6_ADDR_GEN_MODE="stable-privacy"

    NAME="eth0"

    UUID="e83c3691-8c75-4611-8cc1-16a5089c13ca"

    DEVICE="eth0"

    ONBOOT="yes"

    IPADDR="x.x.x.x"

    GATEWAY="x.x.x.x"

    DNS1="x.x.x.x"

    DNS2="x.x.x.x"

    IPV6_PRIVACY="no"

    NM_CONTROLLED="no"

    [[email protected] network-scripts]#

    [[email protected] network-scripts]# reboot


    login as: root

    [email protected]'s password:

    Last login: Fri Apr 8 13:35:22 2022 from 192.168.114.169

    [[email protected] ~]#

    [[email protected] ~]#

    [[email protected] ~]# ip addr

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

      inet 127.0.0.1/8 scope host lo

        valid_lft forever preferred_lft forever

      inet6 ::1/128 scope host

        valid_lft forever preferred_lft forever

    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

      link/ether 50:6b:8d:eb:fe:43 brd ff:ff:ff:ff:ff:ff

      inet x.x.x.x/8 brd 10.255.255.255 scope global eth0

        valid_lft forever preferred_lft forever

      inet x.x.x.x/24 brd 10.250.40.255 scope global dynamic eth0

        valid_lft 28525sec preferred_lft 28525sec

      inet6 fe80::526b:8dff:feeb:fe43/64 scope link

        valid_lft forever preferred_lft forever

    [[email protected] ~]#

    Thanks & Best Regards

    Jamsher

  • remzi.akyuz
    remzi.akyuz Member Posts: 199 Bronze Badge

    Could you check all ifcfg- files.

    ls -la /etc/sysconfig/network-scripts/

    +1 could you move unneccery files to /root

    mv /etc/sysconfig/network-scripts/ifcfg-eth0.bkp /root/

    then reboot your system

    MSABRA
  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    @remzi.akyuz


    Followed same steps are instructed and issue is resolved. Thanks for your support.

    But the file ifcfg-eth0.bkp how it was impacting ?. I created it with .bkp extension so system should ignore it.

    [[email protected] ~]#

    [[email protected] ~]# pwd

    /root

    [[email protected] ~]#

    [[email protected] ~]# ls -ltr

    total 8

    -rw-------. 1 root root 1549 Mar 30 15:31 anaconda-ks.cfg

    -rw-r--r--. 1 root root 427 Apr 4 14:17 ifcfg-eth0.bkp

    [[email protected] ~]#

    [[email protected] ~]# /etc/sysconfig/network-scripts/

    -bash: /etc/sysconfig/network-scripts/: Is a directory

    [[email protected] ~]#

    [[email protected] ~]# cd /etc/sysconfig/network-scripts/

    [[email protected] network-scripts]#

    [[email protected] network-scripts]# ls -ltr ifcfg*

    -rw-r--r--. 1 root root 254 May 22 2020 ifcfg-lo

    -rw-r--r--. 1 root root 434 Apr 8 13:31 ifcfg-eth0

    [[email protected] network-scripts]#

    [[email protected] network-scripts]# reboot


    login as: root

    [email protected]'s password:

    Last login: Fri Apr 8 13:38:51 2022 from 192.168.114.169

    [[email protected] ~]#

    [[email protected] ~]# ip addr

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

      inet 127.0.0.1/8 scope host lo

        valid_lft forever preferred_lft forever

      inet6 ::1/128 scope host

        valid_lft forever preferred_lft forever

    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

      link/ether 50:6b:8d:eb:fe:43 brd ff:ff:ff:ff:ff:ff

      inet x.x.x.x/8 brd 10.255.255.255 scope global eth0

        valid_lft forever preferred_lft forever

      inet6 fe80::526b:8dff:feeb:fe43/64 scope link

        valid_lft forever preferred_lft forever

    [[email protected] ~]#

    Thanks & Best Regards

    Jamsher

  • remzi.akyuz
    remzi.akyuz Member Posts: 199 Bronze Badge

    Yes,

    Network services read files if thes start ifcg- :-)

    My advice is to you using network manager, if you did not use spefic application or cluster services.

    nmcli is very usefully tool for network and it solve configuration issue.


    Have a good day with linux :-D

    MSABRA
  • MSABRA
    MSABRA Member Posts: 7 Red Ribbon

    @remzi.akyuz , Thanks for support

apps-infra