CentOS VirtualBox虚拟机多网卡配置

eth0是NAT,另外一块(eth4)是Host-Only.

  1. #确认网卡MAC
    [root@localhost ~]# ifconfig -a | grep HW
    eth0      Link encap:Ethernet  HWaddr 08:00:27:B2:9F:F5
    eth4      Link encap:Ethernet  HWaddr 08:00:27:BB:84:F9
  2. [root@localhost ~]# vi /etc/udev/rules.d/70-persistent-net.rules
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:B2:9F:F5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:BB:84:F9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"
  3. [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE="eth0"
    BOOTPROTO="dhcp"
    HWADDR="08:00:27:B2:9F:F5"
    IPV6INIT="yes"
    NM_CONTROLLED="yes"
    ONBOOT="yes"
    TYPE="Ethernet"
    UUID="56f45b3e-1d42-4cf8-a78e-4a041835f3a1"
  4. [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth4
    DEVICE="eth4"
    BOOTPROTO=static
    IPADDR=192.168.56.102
    GATEWAY=192.168.56.1
    NETMASK=255.255.255.0
    HWADDR="08:00:27:BB:84:F9"
    NM_CONTROLLED="yes"
    ONBOOT="yes"
    TYPE="Ethernet"
    UUID="56f45b3e-1d42-4cf8-a78e-4a041835f3a1"









你可能感兴趣的:(centos,NetWork,VirtualBox)