桥接模拟的设备到网卡
1、EVE的两个网卡。
2、root@eve-ng:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
iface eth0 inet manual <<<<<<<<<<这是我们的管理接口,是VMnet8
auto pnet0
iface pnet0 inet dhcp
bridge_ports eth0
bridge_stp off
# Cloud devices
iface eth1 inet manual <<<<<<<<<<<这是我们的桥接接口,选择的是VMnet1这个网卡
auto pnet1
iface pnet1 inet dhcp
bridge_ports eth1
bridge_stp off
iface eth2 inet manual
auto pnet2
iface pnet2 inet manual
bridge_ports eth2
bridge_stp off
iface eth3 inet manual
auto pnet3
iface pnet3 inet manual
bridge_ports eth3
bridge_stp off
iface eth4 inet manual
auto pnet4
iface pnet4 inet manual
bridge_ports eth4
bridge_stp off
iface eth5 inet manual
auto pnet5
iface pnet5 inet manual
bridge_ports eth5
bridge_stp off
iface eth6 inet manual
auto pnet6
iface pnet6 inet manual
bridge_ports eth6
bridge_stp off
iface eth7 inet manual
auto pnet7
iface pnet7 inet manual
bridge_ports eth7
bridge_stp off
iface eth8 inet manual
auto pnet8
iface pnet8 inet manual
bridge_ports eth8
bridge_stp off
iface eth9 inet manual
auto pnet9
iface pnet9 inet manual
bridge_ports eth9
bridge_stp off
# nat device
auto nat0
iface nat0 inet static
bridge_ports none
bridge_stp off
address 169.254.254.1
netmask 255.255.255.0
up service udhcpd restart
3、root@eve-ng:~# ifconfig
......
pnet0 Link encap:Ethernet HWaddr 00:0c:29:5d:66:71
inet addr:10.1.2.128 Bcast:10.1.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5d:6671/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21955 errors:0 dropped:0 overruns:0 frame:0
TX packets:19345 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44941444 (44.9 MB) TX bytes:4155467 (4.1 MB)
pnet1 Link encap:Ethernet HWaddr 00:0c:29:5d:66:7b
inet6 addr: fe80::20c:29ff:fe5d:667b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:476 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:57955 (57.9 KB) TX bytes:1208 (1.2 KB)
......
4、重启网卡(因为之前pnet1是Manuel的,可以看到修改为了dhcp)
root@eve-ng:~# /etc/init.d/networking restart
Restarting networking (via systemctl): networking.service.
此时再使用ifconfig可以看到pnet1已经获取到了IP地址。
pnet0 Link encap:Ethernet HWaddr 00:0c:29:5d:66:71
inet addr:10.1.2.128 Bcast:10.1.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5d:6671/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:145 errors:0 dropped:0 overruns:0 frame:0
TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15140 (15.1 KB) TX bytes:27044 (27.0 KB)
pnet1 Link encap:Ethernet HWaddr 00:0c:29:5d:66:7b
inet addr:10.0.0.128 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5d:667b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:704 (704.0 B) TX bytes:1402 (1.4 KB)
5、测试
此时可以在EVE中桥接。
选择Network
然后选择一个Cloud,只要同一个网段即可通信。
我们使用该Cloud和C7206的接口E1/2连接.
接下来在C7206上配置IP地址。
Router(config)#int e1/2
Router(config-if)#ip add 10.0.0.129 255.255.255.0
Router(config-if)#no shu
Router(config-if)#end
此时我们来ping pnet1和Vmnet1
Router#ping 10.0.0.128
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.128, timeout is 2 seconds:
.!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/12/16 ms
Router#ping 10.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
.!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/13/20 ms
可以看到已经没问题。