-netdev tap,ifname=tap1,id=network-0,vhost=on,script=no,downscript=no -device driver=virtio-net-pci,netdev=network-0,mac=02:42:ac:11:00:02,disable-modern=false,mq=on,vectors=4,romfile=
root@cloud:/data1/core# ps -elf | grep vhost-8220 1 S root 8225 2 0 80 0 - 0 vhost_ 11:17 ? 00:00:00 [vhost-8220]
root@cloud:/data1/core# ip a 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: enahisic2i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 9c:52:f8:67:c4:d3 brd ff:ff:ff:ff:ff:ff inet 10.10.16.47/24 brd 10.10.16.255 scope global enahisic2i0 valid_lft forever preferred_lft forever inet6 fe80::9e52:f8ff:fe67:c4d3/64 scope link valid_lft forever preferred_lft forever 3: enahisic2i1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 9c:52:f8:67:c4:d4 brd ff:ff:ff:ff:ff:ff 4: enahisic2i2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 9c:52:f8:67:c4:d5 brd ff:ff:ff:ff:ff:ff inet 10.10.104.47/24 scope global enahisic2i2 valid_lft forever preferred_lft forever inet6 fe80::9e52:f8ff:fe67:c4d5/64 scope link valid_lft forever preferred_lft forever 5: enahisic2i3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 9c:52:f8:67:c4:d6 brd ff:ff:ff:ff:ff:ff 6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:99:67:f5:bc brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 valid_lft forever preferred_lft forever inet6 fe80::42:99ff:fe67:f5bc/64 scope link valid_lft forever preferred_lft forever 105: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff 109: tap1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 66:31:bf:3b:f8:95 brd ff:ff:ff:ff:ff:ff root@cloud:/data1/core# brctl show bridge name bridge id STP enabled interfaces docker0 8000.02429967f5bc no virbr0 8000.000000000000 no root@cloud:/data1/core#
root@cloud:/data1/core# ip link set tap1 up root@cloud:/data1/core# ip a add 192.168.122.49/24 dev tap1 root@cloud:/data1/core# ping 192.168.122.48 PING 192.168.122.48 (192.168.122.48) 56(84) bytes of data. 64 bytes from 192.168.122.48: icmp_seq=1 ttl=64 time=0.852 ms 64 bytes from 192.168.122.48: icmp_seq=2 ttl=64 time=0.116 ms ^C --- 192.168.122.48 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1032ms rtt min/avg/max/mdev = 0.116/0.484/0.852/0.368 ms
虚拟机
root@(none):/# ip a 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff root@(none):/# ip link set eth0 up root@(none):/# ip a add 192.168.122.48/24 dev eth0 root@(none):/# ip a 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff inet 192.168.122.48/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe11:2/64 scope link valid_lft forever preferred_lft forever root@(none):/#