LoginSignup
1
1

More than 5 years have passed since last update.

CentOS6で、ダミーインターフェイス作成と削除

Posted at

・手順と確認

1、modprobeでdummyモジュールを追加。dummy0が使えるようになる。
2、ipコマンドで、dummy0にeth10という名前を付ける。
3、ifconfigで、eth10にIPアドレスを設定して利用可能にする。
4、ifconfigでインターフェイス一覧を表示。eth10が表示されている。
5、eth10に設定したIPアドレスにpingを打つ。応答する。
6、作成したダミーインターフェイスを、ipコマンドで削除する。
7、ifconfigでインターフェイス一覧を表示。eth10がなくなっている。
8、eth10に設定してあったIPアドレスにpingを打つ。応答なし。
9、modprobeでdummyモジュールを削除する。

・実際にやってみた結果

[root@localhost ~]# modprobe -a dummy
[root@localhost ~]# ip link set name eth10 dev dummy0
[root@localhost ~]# ifconfig eth10 192.168.100.101 netmask  255.255.255.0
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:22:33:44:55
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::250:ffff:ffff:1234/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2061 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:242700 (237.0 KiB)  TX bytes:1243289 (1.1 MiB)

eth10     Link encap:Ethernet  HWaddr 0E:CD:D2:24:7E:86
          inet addr:192.168.100.101  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::ccd:d2ff:fe24:7e86/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:70 (70.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:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:672 (672.0 b)  TX bytes:672 (672.0 b)

[root@localhost ~]# ping 192.168.100.101
PING 192.168.100.101 (192.168.100.101) 56(84) bytes of data.
64 bytes from 192.168.100.101: icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from 192.168.100.101: icmp_seq=2 ttl=64 time=0.035 ms
64 bytes from 192.168.100.101: icmp_seq=3 ttl=64 time=0.033 ms
64 bytes from 192.168.100.101: icmp_seq=4 ttl=64 time=0.034 ms
64 bytes from 192.168.100.101: icmp_seq=5 ttl=64 time=0.032 ms
^C
--- 192.168.100.101 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4646ms
rtt min/avg/max/mdev = 0.028/0.032/0.035/0.005 ms
[root@localhost ~]#
[root@localhost ~]# ip link delete eth10
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:22:33:44:55
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::250:ffff:ffff:1234/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2494 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:262680 (256.5 KiB)  TX bytes:1261657 (1.2 MiB)

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:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1512 (1.4 KiB)  TX bytes:1512 (1.4 KiB)

[root@localhost ~]# ping 192.168.100.101
PING 192.168.100.101 (192.168.100.101) 56(84) bytes of data.
^C
--- 192.168.100.101 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1828ms

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# modprobe -r dummy
[root@localhost ~]#

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1