Xen:虚拟机网络配置

注:以下Xen版本为4.4.0

Xen网络配置有两种,一是网桥,二是NAT。
1、网桥

①修改文件 /etc/network/interfaces:
    auto xenbr0
    iface xenbr0 inet dhcp
        bridge_ports eth0

②在虚拟机配置文件中:
    vif = ['bridge = xenbr0']

2、NAT

①修改文件 /etc/network/interfaces:
    auto xenbr0
    iface xenbr0 inet static
         bridge_ports none
         bridge_stp no
         address 10.0.0.1
         netmask 255.255.255.0
         network 10.0.0.0
         broadcast 10.0.0.255

②修改文件 /etc/sysctl.conf:
     添加:net.ipv4.ip_forward = 1
     终端执行:sysctl -p /etc/sysctl.conf

③ 终端执行:
        sudo iptables-save > /etc/iptables-rules
  修改文件 /etc/network/interfaces:
        添加: pre-up iptables-restore < /etc/iptables-rules
        post-down iptables-save > /etc/iptables-rules

④修改DomU,假如位win7:
    修改ipv4为静态地址10.0.0.2 gw 10.0.0.1
    修改虚拟机配置文件:
        vif=['bridge=xenbr0,ip=10.0.0.2']
 关闭虚拟机里的防火墙!
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值