Search

Thursday, October 13, 2016

Create a local dummy virtual network interface on Linux | CentOS 7 dummy NIC for use by Virtual Machines



Need a dummy NIC for a virtual machine running a router or a switch?

To create a dummy network interface eth10 and an alias on it eth10:0 with an IP address on CentOS 7, steps are:

# /sbin/modprobe dummy
# /sbin/lsmod | /bin/grep dummy
dummy                  12960  0
# /sbin/ip link set name eth10 dev dummy0
# /sbin/ifconfig eth10 hw ether 00:22:22:ff:ff:ff # Change MAC if needed
# /sbin/ip addr add 192.168.100.199/24 brd + dev eth10 label eth10:0 # Create alias, add IP
# /sbin/ip addr show eth10
8: eth10: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN
    link/ether 00:22:22:ff:ff:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.199/24 brd 192.168.100.255 scope global eth10:0
       valid_lft forever preferred_lft forever

To remove the dummy NIC created above:

# /sbin/ip addr del 192.168.100.199/24 brd + dev eth10 label eth10:0  # delete the IPs first including aliases
# /sbin/ip link delete eth10 type dummy
#  /sbin/rmmod dummy

That's it.

No comments:

Post a Comment

"SEO" link builders: move on, your spam link will not get posted.

Note: Only a member of this blog may post a comment.

Recommended Products from Amazon