Remove network interface permanently

92,374

Solution 1

Open the file /etc/network/interfaces in your terminal

sudo nano /etc/network/interfaces

Add this line:

iface eth1 inet manual

Save the file and run

sudo service network-manager restart

or

sudo systemctl restart network-manager.service

Source

Solution 2

To remove permanently I think you should use this

sudo nmcli connection show

The result looks like:

NAME                UUID                                  TYPE       DEVICE 
front               2cf067c7-e0ad-4072-b60f-60a7733b5c27  wifi       wlp1s0 
wg0                 ab0b9039-c4b1-48af-b30c-adcbea993643  wireguard  wg0    
WebSolutions        07749022-afa7-467e-a625-a87de9875ab7  vpn        --     
BlackHome           061a7dbf-5d7d-4992-a78d-015b3d93f5af  wifi       --    

then remove by UUID

sudo nmcli connection delete ab0b9039-c4b1-48af-b30c-adcbea993643
Share:
92,374

Related videos on Youtube

youri
Author by

youri

Updated on September 18, 2022

Comments

  • youri
    youri over 1 year

    I'm trying to remove a network interface permanently. For some reason, ifconfig lists eth0 and eth1, although the latter RX/TX metrics remain at zero.

    I suspect that extra eth1 entry might be causing delays during boot.

    Surprinsgly, a search did not yield any answer on how to proceed. Most posts either are for older versions of Ubuntu or Debian, or for other distros (RedHat), or have no permanent effect, or pertain to adding an interface, or try to turn it off but after it's been started, or are simply unanswered. But the answer might be somewhere after Google's thrid result page.

    Removing the second entry from the desktop (up and down arrows, on the top bar) has no effect either on ifconfig.

    EDIT: I actutally do have two network cards on the MB. That's a bit of a surprise I admit. I don't have wifi. Question still stands, a least out of curiosity.

    krakoukass@durum:~$ ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:1f:d0:a3:40:d9  
              inet addr:192.168.1.66  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::21f:d0ff:fea3:40d9/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:84 errors:0 dropped:0 overruns:0 frame:0
              TX packets:93 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:12255 (12.2 KB)  TX bytes:12241 (12.2 KB)
    
    eth1      Link encap:Ethernet  HWaddr 00:1f:d0:a3:40:db  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:634 errors:0 dropped:0 overruns:0 frame:0
              TX packets:634 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:64758 (64.7 KB)  TX bytes:64758 (64.7 KB)
    
    krakoukass@durum:~$ lspci | grep -i eth
    04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 02)
    05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 02)
    
    krakoukass@durum:~$ cat /etc/network/interfaces
    # interfaces(5) file used by ifup(8) and ifdown(8)
    auto lo
    iface lo inet loopback
    
    krakoukas@durum:~$ systemctl -l status [email protected][email protected] - ifup for eth1
       Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
       Active: active (exited) since Fri 2015-05-15 12:36:34 CEST; 14min ago
      Process: 457 ExecStart=/bin/sh -ec ifup --allow=hotplug %I; ifup --allow=auto %I;      if ifquery %I >/dev/null; then ifquery --state %I >/dev/null; fi (code=exited, status=0/SUCCESS)
     Main PID: 457 (code=exited, status=0/SUCCESS)
    
    May 15 12:36:34 durum systemd[1]: Started ifup for eth1.
    May 15 12:36:34 durum systemd[1]: Starting ifup for eth1...
    May 15 12:36:34 durum sh[457]: Unknown interface eth1
    
    krakoukas@durum:~$ systemctl -l status [email protected][email protected] - ifup for eth0
       Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
       Active: active (exited) since Fri 2015-05-15 12:36:34 CEST; 15min ago
      Process: 458 ExecStart=/bin/sh -ec ifup --allow=hotplug %I; ifup --allow=auto %I;      if ifquery %I >/dev/null; then ifquery --state %I >/dev/null; fi (code=exited, status=0/SUCCESS)
     Main PID: 458 (code=exited, status=0/SUCCESS)
    
    May 15 12:36:34 durum systemd[1]: Started ifup for eth0.
    May 15 12:36:34 durum systemd[1]: Starting ifup for eth0...
    May 15 12:36:34 durum sh[458]: Unknown interface eth0
    

    Thanks in advance for you help.

    • chili555
      chili555 almost 9 years
      "I don't think I have two almost-identical network cards" I think you do and I doubt this is the cause of a boot delay.
    • youri
      youri almost 9 years
      1°- You're right, the MB user manual specifies 2x Realtek 8111C chips, and the BIOS shows two entries H/W LAN1 and H/W LAN2. Amazing.
    • youri
      youri almost 9 years
      2°- "I doubt this is the cause of a boot delay" -- would you care to elaborate, maybe in the other topic? The network manager is taking up a lot of time and seems to dwell on eth0 and/or eth1.
  • Fabby
    Fabby over 8 years
    Good one! Add to remove! :D
  • A.B.
    A.B. over 8 years
    @Fabby Sometimes less is more.
  • Dushyant Bangal
    Dushyant Bangal about 6 years
    How does this even work? It solved my issue, I checked the file and its still the same!
  • Hovo
    Hovo over 5 years
    This is not removing the interface, it's causing the computer to wait for a DHCP lease as you have "manually" assigned one to it