Virtual Box中 CentOS双网卡设置:
 
在Virtual Box中安装CentOS x86-64 6.4(final),配置了双网卡,eth0 为桥接模式 , eth1为内网模式
 
配置对应文件:[root@compute1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:6A:0A:50
TYPE=Ethernet
UUID=daed07c6-42df-4d1a-a6dc-15be73161da3
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.137.182
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=192.168.137.1
DEFROUTE=yes
 
配置对应文件:[root@compute1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=08:00:27:EF:C0:28
TYPE=Ethernet
UUID=23f6bf7a-6eaf-48e9-8d73-1df8e23d843e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.182
NETMASK=255.255.255.0
DEFROUTE=yes
 
在eth1中不能设置GATEWAY,因为linux GATEWAY的加载是先加载eth0 在加载eth1 这样会覆盖eht0中的GATEWAY。
 
配置文件:[root@compute1 ~]# vi /etc/resolv.conf
nameserver 192.168.137.1
 
修改hostname 为: compute1
配置文件:[root@compute1 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=compute1
 
配置文件:[root@compute1 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.1 compute1
 

如果不小心在eth1中添加了GATEWAY,则除了编辑文件ifcfg-eth1去掉GATWAY之外,还要添加默认路由:
[root@controller1 etc]# route add default gw 192.168.137.1
 
此时路由信息由:
[root@controller1 etc]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.137.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1
 
变成了:
[root@controller1 etc]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.137.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1
0.0.0.0         192.168.137.1   0.0.0.0         UG    0      0        0 eth0

Virtual Box中 CentOS双网卡设置的更多相关文章

  1. 【荐】利用NAT、Host-Only双虚拟网卡,实现Virtual Box中CentOS5.x联网

    一.虚拟机与主机互联,通常有三种方式,详细介绍请看: VMware虚拟机三种网络模式(Bridged,Nat,Host-only)区别详解 二.通过网络共享,Host-Only联网,详细案例请看: W ...

  2. 【强烈推荐】利用NAT、Host-Only双虚拟网卡,实现Virtual Box中CentOS6.3联网

    问题背景: 先前都是在Virtual Box中以“网络共享”方式,让里面的Linux虚拟机Host-Only方式联网,参考如下: Virtual Box下配置Host-Only联网方式详解 但最近被公 ...

  3. 在 Virtual Box 中为 CentOS7 mini 配置双网卡

    1. 配置过程 1.1 需求分析 要同时满足虚拟机访问互联网和远程连接,需要配置两块网卡. 一块为 NAT 网络,这块用来访问互联网. 另一块为 Host-Only 网络,进行远程连接.   1.2 ...

  4. virtual box 中两个虚拟机 、宿主机 三机互通并且能上外网设置

    virtual box 中两个虚拟机 .宿主机 三机互通并且能上外网设置 1:背景:因为需要学习linux,所以需要在虚拟机里装linux系统,测试要么宿主机与虚拟机linux网络实验测试:要么另一台 ...

  5. 为 Virtual Box 中的 CentOS 6.6 配置本地DVD光盘做yum软件源

    因为virtual box 中的centos配置host-only共享win7上网,配置失败,所以只能使用Centos的 DVD 光盘来配置yum软件源.不然就没得完了. 1. 首先要在virtual ...

  6. CentOS双网卡双IP设置

    CentOS双网卡双IP设置 系统环境:CentOS Linux 网络环境: 两个IP地址,192.168.0.10和10.10.30.2,掩码是255.255.255.0,这两个子网的网关地址分别是 ...

  7. centos双网卡配置

    centos双网卡问题,一个网卡配置局域网,一个网卡配置公网,如果内网访问自动走eth1,如果外网访问自动走eth2. 需要配置路由吗? 1. 首先查看机器是否是双网卡,命令如下: lspci | g ...

  8. windows2003服务器双线双IP双网卡设置方法

    双线双ip很好,网通用户访问网通线路,电信用户访问电信线路.但很多人会选用导入静态路由表,这个办法看似完美,其实问题很多. 1.电信用户如果被解析到网通的ip上,服务器根据路由表会返回电信线路,但用户 ...

  9. linux中配置双网卡的目的?如何实现双网卡绑定,以实现负载均衡?

    配置双网卡的目的:========================== 1.你想做路由器,网关 2.实现冗余 3.负载均衡     linux 主机安装双网卡,共享一个IP地址,对外提供访问,实际 同 ...

随机推荐

  1. c语言函数传递数组

    1.传递数组,打印不出来 #include <stdio.h> void solve() { printf(]); } int main() { int i; ;i<n;i++) { ...

  2. Matrix multiplication hdu4920

    Problem Description Given two matrices A and B of size n×n, find the product of them. bobo hates big ...

  3. 使用在storyBoard之外的xib创建对象

    1.在storyBoard之外的xib 要注意的是:TableView的代理一定要设置为FilesOwner 使用: 方式一: 直接创建对象如下,(如果要使用xib里的控件,那么就要将xib里的控件作 ...

  4. iOS开发:获取设备IP地址

    一.导入头文件 //首先导入头文件信息 #include <ifaddrs.h> #include <arpa/inet.h> #include <net/if.h> ...

  5. MySQL 更改默认编码为 utf8 (转)

      转自blog.sina.com.cn/s/blog_4c451e0e0100vefm.html 1.打开MySQL安装目录找到 my.ini,如:C:\Program Files\MySQL\My ...

  6. 理解Android系统的进程间通信原理(一)----RPC中的代理模式

    Android系统中的进程间通信是通过一个轻量级的RPC(Remote Procedure Call远程进程调用)和AIDL(Android Interface Definination Langua ...

  7. 钓鱼 贪心 end

    #include<iostream> int m,n; int *p; int dis=0; int peo=0; int data[3][2]; int b[3][2]; int da[ ...

  8. trigger,triggerhandler模拟事件

    常用模拟 有时候,需要通过模拟用户操作,来达到单击的效果.例如在用户进入页面后,就触发click事件,而不需要用户去主动单击. 在JQuery中,可以使用trigger()方法完成模拟操作.例如可以使 ...

  9. MyBatis(3.2.3) - Configuring MyBatis using XML, Properties

    The properties configuration element can be used to externalize the configuration values into a prop ...

  10. C#算法基础之选择排序

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...