I want to add a network card to the Oracle VirtualBox for the internal network, and another machine to do the heartbeat heartbeat test.
How to add it.
Turn off the virtual machine and add a virtual NIC:
After you start the virtual machine, you will not see the newly added network card at this time:
[Root@slave2 ~]# Ifconfig
Eth0 Link encap:ethernet hwaddr08:00:27:04:05:16
inet addr:10.192.200.202 bcast:10.192.200.255 Mask : 255.255.255.0
inet6 addr:fe80::a00:27ff:fe04:516/64 scope:link up
broadcast RUNNING multicast mtu:1500 Metric:1
RX packets:321 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33576 (32.7 KiB) txbytes:5508 (5.3 KiB)
Lo Link encap:local loopback
inet addr:127.0.0.1 mask:255.0.0.0 inet6
::: Addr 1/128 up
scope:host RUNNING mtu:16436 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@slave2 ~] #cd/etc/sysconfig/network-scripts/
[Root@slave2 network-scripts]# CP Ifcfg-eth0 ifcfg-eth1
[Root@slave2 network-scripts]# Cat/etc/udev/rules.d/70-persistent-net.rules
# This file is automatically generated bythe/lib/udev/write_net_rules
# program, run by Thepersistent-net-generator . Rules rules file.
# You
can modify it, as long as your Keepeach rule in a single
# line, and change only the value of Thename= key.
# PCI Device 0x8086:0x100e (e1000)
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "08:00:27:04:05:16", attr{type}== "1", kernel== "eth*" , name= "eth0"
# PCI device 0x8086:0x100e (e1000)
subsystem== "NET", action== "Add", drivers== "? *", attr{address} = = "08:00:27:3a:ec:3c", attr{type}== "1", kernel== "eth*", name= "eth1"
[Root@slave2 network-scripts]# VI ifcfg-eth1
Change the DEVICE,HWADDR,IPADDR, delete the gateway
After modification:
[Root@slave2 network-scripts]# Cat Ifcfg-eth1
Device=eth1
hwaddr=08:00:27:3a:ec:3c
type=ethernet
#UUID =a4610b15-fc38-4984-875d-208599054e37
Onboot=yes
nm_controlled=yes
bootproto=static
ipaddr=10.0.0.2
netmask=255.255.255.0
Note: The network card used for the interconnect cannot set the gateway, otherwise it will not connect to the Internet.
Note: MAC address hwaddr must be consistent with the eth1 in the/etc/udev/rules.d/70-persistent-net.rules file, otherwise servicenetwork restart will make an error:
Bringing up interface Eth1:device eth1 does not seem to be present,delaying initialization.
[FAILED]
[root@slave2network-scripts]# Service Network restart
Shutting down interface eth0: [OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing up interface eth0:determining if IP addresses 10.192.200.202 isalready in use for device eth0 ...
[OK]
Bringing up interface eth1:determining if IP address 10.0.0.2 are alreadyin use for device eth1 ...
[OK]
[Root@slave2 network-scripts]# Ifconfig
Eth0 Link encap:ethernet hwaddr 08:00:27:04:05:16 inet addr:10.192.200.202 bcast:10.192.200.255 Mask:2 55.255.255.0 Inet6 addr:fe80::a00:27ff:fe04:516/64 scope:link up broadcast RUNNING multicast mtu:150
0 metric:1 RX packets:3303 errors:0 dropped:0 overruns:0 frame:0 TX packets:343 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:339469 ( 331.5 KiB) TX bytes:49274 (48.1 KiB) eth1 Link encap:ethernet hwaddr 08:00:27:3a:ec:3c inet .0.2 bcast:10.0.0.255 mask:255.255.255.0 inet6 addr:fe80::a00:27ff:fe3a:ec3c/64 scope:link up BROAD
CAST RUNNING multicast mtu:1500 metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 RX txqueuelen:1000 (0.0 b)
TX bytes:636 (636.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:164
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 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)