Wednesday, October 19, 2011

virtualbox 中安装 arch freebsd 设置双网卡

机器上使用virtualbox装着2个虚拟机,分别是arch和freebsd. 在安装的时候都设置的双网卡,一个NAT,一个briged模式.

因为arch就是从freebsd那里学来的rc.conf总控制文件,所有配置都很简单,只要配置rc.conf就可以了

freebsd的rc.conf配置如下

# change ip by jarodlau #
ifconfig_em1="inet 192.168.1.110 netmask 255.255.255.0"

# -- sysinstall generated deltas -- # Wed Oct  5 08:03:16 2011
ifconfig_em0="DHCP"

然后测试一下

# /etc/rc.d/netif restart

arch的rc.conf配置如下

 # Use 'ip addr' or 'ls /sys/class/net/' to see all available interfaces.
#
# Wired network setup
#   - interface: name of device (required)
#   - address: IP address (leave blank for DHCP)
#   - netmask: subnet mask (ignored for DHCP) (optional, defaults to 255.255.255.0)
#   - broadcast: broadcast address (ignored for DHCP) (optional)
#   - gateway: default route (ignored for DHCP)
#
# Static IP example
# interface=eth0
# address=192.168.0.2
# netmask=255.255.255.0
# broadcast=192.168.0.255
# gateway=192.168.0.1
#
# DHCP example
# interface=eth0
# address=
# netmask=
# gateway=

interface=eth0
address=
netmask=
broadcast=
gateway=

interface=eth1
address=192.168.1.111
netmask=255.255.255.0
brodcast=192.168.1.255
gateway=192.168.1.1

配置arch的时候老出现eth0无法自动使用dhcp的情况根据wiki,原来需要修改/etc/rc.local


#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
dhcpcd -k eth0
dhcpcd -nd eth0

这样,vitualbox中的arch和freebsd就可以上网和本地链接了.

参考文档 : freebsd设置网卡
arch network配置


No comments: