up vote 2 down vote favorite
share [g+] share [fb]

For example:

$ ifconfig dummy0 up
$ ifconfig dummy0 "192.168.1.190 netmask 255.255.255.0"

Calling ifconfig with no parameters shows the interface

dummy0    Link encap:Ethernet  HWaddr b6:1f:f3:92:6d:20  
      inet addr:192.168.1.190  Bcast:192.168.1.255  Mask:255.255.255.0
      inet6 addr: fe80::b41f:f3ff:fe92:6d20/64 Scope:Link
      UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:0 (0.0 B)  TX bytes:1050 (1.0 KiB)

How can I bring the interface down so that it doesn't show up in

  • ifconfig
  • ifconfig -a
  • ifconfig dummy0

without rmmod dummy

because dummy is used just for example purposes.

If there is no way to do that, what "throw-away" IP could I set to it and be safe from any trouble?

like

$ ifconfig dummy0 down
$ ifconfig dummy0 0.0.0.0
link|improve this question

72% accept rate
feedback

7 Answers

up vote 5 down vote accepted

Flush the ip:

root@foo:~# ifconfig dummy0 192.168.55.1 netmask 255.255.255.0
root@foo:~# ifconfig dummy0 
dummy0    Link encap:Ethernet  HWaddr 5b:72:32:4f:92:c8  
          inet addr:192.168.55.1  Bcast:192.168.55.255  Mask:255.255.255.0
          UP BROADCAST RUNNING NOARP  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@foo:~# ip address flush dev dummy0
root@foo:~# ifconfig dummy0 down
root@foo:~# ifconfig dummy0 
dummy0    Link encap:Ethernet  HWaddr 5b:72:32:4f:92:c8
          BROADCAST NOARP  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
link|improve this answer
Just what I needed, thank you. – Karolis T. Jul 2 '09 at 8:53
1  
"ifconfig", although still available in most distributions, has been considered deprecated for some time in favour of the "ip" tool. – Jon Topper Jul 6 '09 at 17:11
feedback

there is usually a ifdown script on the root shell.

/sbin/ifdown

Throw away IP addresses are out of question.
Unused interfaces should be shutdown.

link|improve this answer
feedback
$ ifconfig dummy0 127.0.0.4 down

sets it to a loopback address

link|improve this answer
feedback

ifconfig shows the current enabled interfaces. ifconfig -a shows all the interfaces on the system, including those that are down. ifconfig dummy0 will show you the interface you asked for. As such, if you down an interface, it will not show if you do ifconfig, but will if you do ifconfig -a or ask for information about that particular interface. The only way to not display it is if you remove the kernel module or remove the physical interface.

As for disabling in interface, you just need to set it to being down. It does not matter if it still has an IP address assigned to it, for the kernel will not use that interface until you bring it up again.

link|improve this answer
feedback

Whats wrong with this?

root@moppel:~# ifconfig dummy0 192.168.3.124 up
root@moppel:~# ifconfig dummy0
dummy0    Link encap:Ethernet  Hardware Adresse 1a:36:a4:38:b1:d1
          inet Adresse:192.168.3.124  Bcast:192.168.3.255  Maske:255.255.255.0
          inet6-Adresse: fe80::1836:a4ff:fe38:b1d1/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING NOARP  MTU:1500  Metrik:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0
          RX bytes:0 (0.0 B)  TX bytes:11465 (11.1 KiB)

root@moppel:~# ifconfig dummy0 0.0.0.0 down
root@moppel:~# ifconfig dummy0
dummy0    Link encap:Ethernet  Hardware Adresse 1a:36:a4:38:b1:d1
          BROADCAST NOARP  MTU:1500  Metrik:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0
          RX bytes:0 (0.0 B)  TX bytes:11535 (11.2 KiB)
link|improve this answer
feedback

ifdown is the way to do it eg ifdown dummy down

link|improve this answer
Doesn't remove it from ifconfig -a and ifconfig dummy0 still shows old IP address. The correct solution was to flush it, as per answer above. – Karolis T. Jul 2 '09 at 13:31
feedback

You can also use following command to completely remove the dummy interface.

rmmod dummy

if it show busy, then first disable the dummy0 interface & then try again.

I am answering this post After one year but may be helpful for someone ;-)

Rahul Panwar

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.